    #include <bits/stdc++.h>

    using namespace std;

    std::vector<int> getVisionPattern1d()
    {
        return {3, 1, 1, 1, 2, 1};
    }

    int getMove1d(std::vector<int> v)
    {
        int dis = v.size() / 2;
        assert(v.size() == 2 * dis + 1);
        if(dis == 3)
        {
            if(v[dis - 2] == 2)
                return dis + 3;
            return dis - 3;
        }
        if(dis == 2)
        {
            if(v[dis + 2] == 3)
                return dis + 2;
            return dis - 2;
        }
        assert(dis == 1);
        if(v[dis - 1] > dis)
            return dis - 1;
        return dis + 1;
    }

    std::vector<std::vector<int>> getVisionPattern2d()
    {
        return {{3, 1, 1, 1, 2, 1}, 
                {1, 1, 1, 1, 2, 1},
                {1, 1, 1, 1, 2, 1},
                {1, 1, 1, 1, 2, 1},
                {2, 2, 2, 2, 2, 1},
                {1, 1, 1, 1, 1, 1},
            };
    }

    std::pair<int, int> getMove2d(std::vector<std::vector<int>> v)
    {
        int dis = v.size() / 2;
        assert(v.size() == 2 * dis + 1);
        assert(v[dis][dis] == dis);
        int dx = 1, dy = 1;
        if(dis == 3)
        {
            if(v[dis - 2 * dx][dis] == 1)
                dx = -1;
            if(v[dis][dis - 2 * dy] == 1)
                dy = -1;
            assert(v[dis - 2 * dx][dis] == 2);
            assert(v[dis][dis - 2 * dy] == 2);
            return {dis + dx * dis, dis + dy * dis};
        }
        for(int i = 0; i < v.size(); i++)
        {
            for(int j = 0; j < v.size(); j++)
            {
                if(v[i][j] == 3)
                {
                    return {i, j};
                }       
            }
        }
        if(dis == 2)
            assert(false);
        assert(dis == 1);
        int cnt = 0;
        if(v[dis - 1][dis - 1] == 2)
            cnt++;
        if(v[dis - 1][dis + 1] == 2)
            cnt++;
        if(v[dis + 1][dis - 1] == 2)
            cnt++;
        if(v[dis + 1][dis + 1] == 2)
            cnt++;
        if(cnt == 3)
        {
            if(v[dis - 1][dis - 1] == 1)
                return {dis + 1, dis + 1};
            if(v[dis - 1][dis + 1] == 1)
                return {dis + 1, dis - 1};
            if(v[dis + 1][dis - 1] == 1)
                return {dis - 1, dis + 1};
            if(v[dis + 1][dis + 1] == 1)
                return {dis - 1, dis - 1};
            assert(false);
        }
        for(int i = v.size() - 1; i >= 0; i--)
        {
            for(int j = v.size() - 1; j >= 0; j--)
            {
                if(v[i][j] == 2)
                {
                    return {i, j};
                }       
            }
        }
        return {dis + 1, dis + 1};
    }