#include<bits/stdc++.h>

#define ll long long
#define begin begin()
#define end end()
#define pb push_back
#define in insert
#define lldef ll N=0,M=0,K=0;
#define mk make_pair

using namespace std;

vector<int> getVisionPattern1d(){
    vector<int>ANS={1,2,1,3,1};
    return ANS;
}
int getMove1d(vector<int> v){
    ll N=v.size();
    ll mid=v[(N-1)/2];
    ll md=(N-1)/2;
    if(mid==3){
        if(v[md+3]==2){
            return md+3;
        }else{
            return md-3;
        }
    }else if(mid==2){
        if(v[md+2]==3){
            return md+2;
        }else{
            return md-2;
        }
    }else{
        if(v[md+1]==3 and v[md-1]==2){
            return md+1;
        }else if(v[md+1]==2 and v[md-1]==3){
            return md-1;
        }
        if(v[md+1]==1 and v[md-1]==3){
            return md+1;
        }else if(v[md+1]==3 and v[md-1]==1){
            return md-1;
        }
        if(v[md+1]==2 and v[md-1]==1){
            return md+1;
        }else if(v[md+1]==1 and v[md-1]==2){
            return md-1;
        }
    }
    return 0;
}
vector<vector<int>> getVisionPattern2d(){
}
pair<int, int> getMove2d(vector<vector<int>> v){
}
