#include <bits/stdc++.h>
using namespace std;
using ll = long long;


vector<int> getVisionPattern1d(){
    vector<int> v(6);
    v[0] = 3;
    v[1] = 1;
    v[2] = 1;
    v[3] = 1;
    v[4] = 2;
    v[5] = 1;
    return v;
}
int getMove1d(vector<int> v){
    int n = v.size() / 2;
    if(n == 1){
        if(v[0] > v[2]){
            return 0;
        }
        else{
            return 2;
        }
    }
    else if(n == 2){
        if(v[0] == 3){
            return 0;
        }
        else{
            return 4;
        }
    }
    else if(n == 3){
        if(v[1] == 2){
            return 6;
        }
        else{
            return 0;
        }
    }
    else{
        return 0;
    }
}

vector<vector<int>> getVisionPattern2d(){
    vector<vector<int>> vec(20,vector<int>(20,1));
    for(int i = 0; i < 20; ++i){
        for(int j = 0; j < 20; ++j){
            if(((i + (3 * j)) % 10) == 7){
                vec[i][j] = 2;
            }
            if((((i + (3 * j)) % 20) == 11) && ((j % 2) == 1)){
                vec[i][j] = 2;
            }
        }
    }
    return vec;
}

pair<int, int> getMove2d(vector<vector<int>> v){
    int N = v.size();
    int n = v.size() / 2;
    int num = 0;
    pair<int,int> ans = {0,0};
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < N; ++j){
            if(v[i][j] == 2){
                num++;
                if((i != 2) || (j != 2)){
                    ans = {i,j};
                }
            }
        }
    }
    if(n == 1){
        
        if(num){
            for(int i = 0; i < N; ++i){
                for(int j = 0; j < N; ++j){
                    if(v[i][j] == 2){
                        ans = {i,j};
                        return ans;
                    }
                }
            }
        }
        else{
            ans = {1,0};
            return ans;
        }
    }
    else{
        if(num == 1){
            ans = {2,0};
            return ans;
        }
        else if(num == 3){
            if(v[0][2] == 2){
                ans = {0,2};
                return ans;
            }
            else if(v[4][2] == 2){
                ans = {4,2};
                return ans;
            }
            else if(v[2][0] == 2){
                ans = {2,0};
                return ans;
            }
            else{
                ans = {2,4};
                return ans;
            }
        }
        else{
            if(v[2][0] == 2){
                ans = {2,4};
                return ans;
            }
            else if(v[2][4] == 2){
                ans = {2,0};
                return ans;
            }
            else{
                return ans;
            }
        }
    }
    return ans;
}























