#include "vision.h"
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define ll long long
#define MP make_pair
using namespace std;
const int N=2e5+5;

vector<int> getVisionPattern1d()
{
    //return {3,1,2,1,1,2,1,2,1,1};
}
int getMove1d(vector<int> v)
{
    /*int x=(int)v.size()/2;
    if(x==1)
    {
        if(min(v[0],v[2])==2&&max(v[0],v[2])==3) return (v[2]==2 ? 2:0);
        if(v[0]==1&&v[2]==1)
    }
    else if(x==2)
    {
        if(v[x+1]==3) return x+1;
        else return x-1;
    }
    else if(x==3)
    {
        if(v[x+1]==4) return x+2;
        else return x-2;
    }
    else
    {
        if(v[x+1]==1) return x+1;
        else return x-1;
    }*/
}

vector<vector<int>> getVisionPattern2d()
{
    return {{1,2,3},{4,5,6},{7,8,9}};
}
pair<int,int> getMove2d(vector<vector<int>> v)
{
    int x=(int)v.size()/2;
    if(x%3!=0)
    {
        if(v[x-1][x-1]==(x+3)%9+1) return MP(x-1,x-1);
        if(v[x-1][x+1]==(x+3)%9+1) return MP(x-1,x+1);
        if(v[x+1][x-1]==(x+3)%9+1) return MP(x+1,x-1);
        if(v[x+1][x+1]==(x+3)%9+1) return MP(x+1,x+1);
        assert(0);
    }
    if(v[x-1][x-1]==x%9+1) return MP(x-1,x-1);
    if(v[x-1][x+1]==x%9+1) return MP(x-1,x+1);
    if(v[x+1][x-1]==x%9+1) return MP(x+1,x-1);
    if(v[x+1][x+1]==x%9+1) return MP(x+1,x+1);
    assert(0);
}
