#define ll long long
#define se second
#define fi first
using namespace std;
#include<utility>
#include<algorithm>
#include<vector>

const char nl = '\n';

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

    int getMove1d(std::vector<int> v) {
        int n = v.size();
        if (v[n / 2] == 3) {
            if (v[n / 2 - 1] == 2) {
                return n / 2 - 1;
            } else {
                return n / 2 + 1;
            }
        } else {
            int mx = 0;
            for (int i = 0; i < n; i++) {
                if (v[mx] < v[i]) {
                    mx = i;
                }
            }
            return mx;
        }
    }

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

    std::pair<int, int> getMove2d(std::vector<std::vector<int>> v) {
        int n = v.size();
        int i, j;
        i = n / 2;
        j = n / 2;
        if (v[n / 2][n / 2] % 3 + 1 == v[n / 2][n / 2 + 1]) {
            j++;
        } else {
            j--;
        }
        if (v[n / 2][n / 2] % 3 + 1 == v[n / 2 + 1][n / 2]) {
            i++;
        } else {
            i--;
        }
        return {i, j};
    }