Problem: 2049C - MEX Cycle
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
//Patta Anaro Ka

//Patta Chanaro Ka

//Jaise Hawaon Me

//Aise Bhatakta Hu

//Din Raat Dikhta Hu

//Mai Teri Rahon Me









#include<bits/stdc++.h>

using namespace std;

#include <cctype>

#define M 1000000007

#define ll long long

#define rep(i,s,n) for(ll i=s; i<n; i++)

#define pb push_back

#define F first

#define S second

#define mp make_pair

#define endl "\n"

#define all(v) v.begin(),v.end()

#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)

#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper)

#define srt(v) sort(v.begin(),v.end())

#define rsrt(v) sort(v.rbegin(),v.rend())

#define vi vector<ll>

#define pll pair<ll,ll>

#define vp vector<pair<ll,ll>>

#define seea(a,n) for(ll i=0;i<n;i++){cin>>a[i];}

#define seed(a,n,m) for(ll i = 0;i<n;i++){for(ll j = 0;j<m;j++){cin>>a[i][j];}}

#define show(a,n) for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<endl;

#define yy cout<<"YES"<<"\n";

#define nn cout<<"NO"<<"\n";



bool isArraySorted(vector<ll>& arr) {

    for (size_t i = 0; i < arr.size() - 1; i++) {

        if (arr[i] > arr[i + 1]) {

            return false; // Array is not sorted

        }

    }

    return true; // Array is sorted

}



int fMSB(int num) {

    return 63 - __builtin_clzll(num);

}



bool comp(pair<ll,ll> a,pair<ll,ll> b){

    return a.first>b.first;

}



bool comp2(pair<ll,ll>a,pair<ll,ll>b){

    return a.first<b.first;

}



ll gcd(ll a,ll b){

    if(b==0)return a;

    return gcd(b,a%b);

}



bool check(vector<ll>&arr,ll x){

    ll l=0;

    ll r=arr.size()-1;

    bool f=true;

    while(l<=r){

        while(arr[l]==x)l++;

        while(arr[r]==x)r--;

        if(l>r)break;

        if(arr[l]!=arr[r]){

            f=false;

            break;

        }l++;

        r--;

    }

    return f;

}



int func(vector<ll>&arr, int x) {

    int lo = 0;

    int hi = x;

    int ans = 0;

    while (lo <= hi) {

        int mid = lo + (hi - lo) / 2;

        if (arr[mid] >= x - mid + 1) {

            ans = x - mid + 1;

            hi = mid - 1; 

        } else {

            lo = mid + 1;

        }

    }

    return ans;

}



void solve() {

   ll n,x,y;

   cin>>n>>x>>y;

   vector<ll>ans;

    rep(i,0,n/2){

        ans.push_back(0);

        ans.push_back(1);

    }

    if(n%2==1){

        ans.push_back(2);

    }

    ll r1=x%2;

    ll r2=y%2;

    // cout<<r1+r2;

    if(n%2==0 && (r1+r2==0 || r1+r2==2)){

        ans[x-1]=2;

    }else if((r1+r2==0 || r1+r2==2) && (x!=n || y!=n)){

        if(x==1){

            ans[y-1]=2;

        }else{

            ans[x-1]=2;

        }

    }

   show(ans,ans.size());

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    ll t;

    cin >> t;

    while (t--) {   

        solve();

    }

}



// _______________________________________________BY SOUMYADEEP__________________________________________________________________________________

Submission (verdict: Accepted):
//Patta Anaro Ka

//Patta Chanaro Ka

//Jaise Hawaon Me

//Aise Bhatakta Hu

//Din Raat Dikhta Hu

//Mai Teri Rahon Me









#include<bits/stdc++.h>

using namespace std;

#include <cctype>

#define M 1000000007

#define ll long long

#define rep(i,s,n) for(ll i=s; i<n; i++)

#define pb push_back

#define F first

#define S second

#define mp make_pair

#define endl "\n"

#define all(v) v.begin(),v.end()

#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)

#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper)

#define srt(v) sort(v.begin(),v.end())

#define rsrt(v) sort(v.rbegin(),v.rend())

#define vi vector<ll>

#define pll pair<ll,ll>

#define vp vector<pair<ll,ll>>

#define seea(a,n) for(ll i=0;i<n;i++){cin>>a[i];}

#define seed(a,n,m) for(ll i = 0;i<n;i++){for(ll j = 0;j<m;j++){cin>>a[i][j];}}

#define show(a,n) for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<endl;

#define yy cout<<"YES"<<"\n";

#define nn cout<<"NO"<<"\n";



bool isArraySorted(vector<ll>& arr) {

    for (size_t i = 0; i < arr.size() - 1; i++) {

        if (arr[i] > arr[i + 1]) {

            return false; // Array is not sorted

        }

    }

    return true; // Array is sorted

}



int fMSB(int num) {

    return 63 - __builtin_clzll(num);

}



bool comp(pair<ll,ll> a,pair<ll,ll> b){

    return a.first>b.first;

}



bool comp2(pair<ll,ll>a,pair<ll,ll>b){

    return a.first<b.first;

}



ll gcd(ll a,ll b){

    if(b==0)return a;

    return gcd(b,a%b);

}



bool check(vector<ll>&arr,ll x){

    ll l=0;

    ll r=arr.size()-1;

    bool f=true;

    while(l<=r){

        while(arr[l]==x)l++;

        while(arr[r]==x)r--;

        if(l>r)break;

        if(arr[l]!=arr[r]){

            f=false;

            break;

        }l++;

        r--;

    }

    return f;

}



int func(vector<ll>&arr, int x) {

    int lo = 0;

    int hi = x;

    int ans = 0;

    while (lo <= hi) {

        int mid = lo + (hi - lo) / 2;

        if (arr[mid] >= x - mid + 1) {

            ans = x - mid + 1;

            hi = mid - 1; 

        } else {

            lo = mid + 1;

        }

    }

    return ans;

}



void solve() {

   ll n,x,y;

   cin>>n>>x>>y;

    vector<ll>ans(n,-1);

    ans[x-1]=0;

    ans[y-1]=1;

    rep(i,0,n){

        if(ans[i]==-1){

            ll l=ans[(i-1+n)%n];

            ll r=ans[(i+1+n)%n];

            ll mn=min(l,r);

            ll mx=max(l,r);

            // cout<<i<<(i-1+n)%n<<" ";

            ll temp=0;

            if(temp==mn)temp++;

            if(temp==mx)temp++;

            ans[i]=temp;

        }   

    }

    // cout<<endl;

    show(ans,ans.size());



    

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    ll t;

    cin >> t;

    while (t--) {   

        solve();

    }

}



// _______________________________________________BY SOUMYADEEP__________________________________________________________________________________