#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include<random>
#include<ctime>

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,bmi,sse4,popcnt")

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uint = unsigned int;

const int N = 2e6 + 2, inf = 1e9 + 100;
const ll llinf = 1e18 + 1000;

vector<int> getVisionPattern1d() {
	return { 3, 2, 1, 1, 2, 1 };
}
int getMove1d(vector<int> a) {
	int len = a.size();
	int x = len / 2;
	if (x == 1) {
		if (a[0] == 2) return 0;
		else
			return 2;
	}
	else if (x == 2) {
		if (a[0] == 3) return 0;
		if (a[1] == 3) return 1;
		if (a[3] == 3) return 3;
		if (a[4] == 3) return 4;
	}
	else {
		if (a[2] == 1) return 0;
		else
			return 6;
	}
}

void solve() {
	
}

//signed main() {
//	ios_base::sync_with_stdio(0);
//	cin.tie(0);
//	int tt = 1;
//	//cin >> tt;
//	while (tt--) {
//		solve();
//		cout << '\n';
//		cout.flush();
//	}
//	return 0;
//}