#include <bits/stdc++.h>
using namespace std;
vector<int> getVisionPattern1d(){
    return {1, 2, 1, 3, 1, 1, 2};
}

int getMove1d(vector<int> v){
    int n = v.size();
    if(v[n / 2] != 3){
        int mx = 0, id = 0;
        for(int i = 0; i < n; i++){
            if(i == n / 2) continue;
            if(v[i] > mx){
                mx = v[i];
                id = i;
            }
        }
        return id;
    }
    if(v[6] == 2) return 6;
    return 0;
}

vector<vector<int>> getVisionPattern2d(){
    vector<vector<int>> p;
    p.push_back({1, 1, 1, 1, 1, 1});
    p.push_back({1, 2, 1, 1, 2, 1});
    p.push_back({1, 1, 1, 1, 1, 1});
    p.push_back({1, 1, 1, 2, 1, 1});
    p.push_back({1, 2, 1, 1, 3, 1});
    p.push_back({1, 1, 1, 1, 1, 1});
    return p;
}

pair<int, int> getMove2d(vector<vector<int>> v){
    int n = (int) v.size();
    if(n <= 5){
        int x = 0, y = 0, mx = 0;
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                if(v[i][j] > mx){
                    mx = v[i][j];
                    x = i; y = j;
                }
            }
        }
        return {x, y};
    }
    if(v[2][2] == 2) return {6, 6};
    if(v[2][4] == 2) return {6, 0};
    if(v[4][2] == 2) return {0, 6};
    if(v[4][4] == 2) return {0, 0};
}
