#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...)
#endif // LOCAL
#define ll long long
#define F first
#define S second
#define pb push_back
#define pii pair<int, int>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
const int N = 2e5 + 5;
const int base = 65536;
const int mod = 1e6 + 7;
const ll inf = 1e18;
int cnt[3][56][mod];
ll score[56];
void excerpt(int E[]) {
memset(score, 0, sizeof(score));
for (int len = 1; len <= 3; len++) {
for (int i = 0; i + len - 1 < 100; i++) {
ll hsh = 0;
for (int j = i; j < i + len; j++) {
hsh = (hsh * base + E[j]) % mod;
}
for (int i = 0; i < 56; i++) score[i] += len * cnt[len - 1][i][hsh];
}
}
int best = 0;
for (int i = 1; i < 56; i++) {
if (score[i] > score[best]) best = i;
}
int L = language(best);
for (int len = 1; len <= 3; len++) {
for (int i = 0; i + len - 1 < 100; i++) {
ll hsh = 0;
for (int j = i; j < i + len; j++) {
hsh = (hsh * base + E[j]) % mod;
}
cnt[len - 1][L][hsh]++;
}
}
}