func_code_string: #include <bits/stdc++.h>   using namespace std;   const int inf = 1000 * 1000 * 1000;   const int maxn = 20;   int n, sz[maxn + maxn], ans, d[maxn + maxn][(1 << maxn)];   vector<int> g[maxn + maxn][26];   bool was[maxn + maxn][(1 << maxn)];   char a[maxn][maxn];   int calc(int v, int mask) {     if (was[v][mask]) return d[v][mask];     was[v][mask] = true;     if (v == n + n - 2) return 0;     if (v % 2)       d[v][mask] = -inf;     else       d[v][mask] = inf;     int lmask, cur;     for (int i = 0; i < 26; i++) {       lmask = 0;       for (int j = 0; j < (int)g[v + 1][i].size(); j++) {         cur = min(v + 1, n - 1) - g[v + 1][i][j];         if (v > n - 2) {           if ((mask & (1 << cur))) lmask |= (1 << cur);         } else {           if (cur && (mask & (1 << (cur - 1)))) lmask |= (1 << cur);         }         if (v > n - 2) {           if ((mask & (1 << (cur + 1)))) lmask |= (1 << cur);         } else {           if (cur != sz[v + 1] - 1 && (mask & (1 << cur))) lmask |= (1 << cur);         }       }       if (!lmask) continue;       if (v % 2)         d[v][mask] = max(d[v][mask], calc(v + 1, lmask) + (!i       ? 1                                                            : i == 1 ? -1                                                                     : 0));       else         d[v][mask] = min(d[v][mask], calc(v + 1, lmask) + (!i       ? 1                                                            : i == 1 ? -1                                                                     : 0));     }     return d[v][mask];   }   int main() {     cin >> n;     for (int i = 0; i < n; ++i)       for (int j = 0; j < n; ++j) cin >> a[i][j];     for (int i = 0; i < n + n - 1; ++i) {       int l = min(i, n - 1), r = max(0, i - n + 1);       while (l >= 0 && r < n) {         g[i][a[l][r] -  a ].push_back(l);         l--;         r++;       }       for (int j = 0; j < 26; j++) sz[i] += (int)g[i][j].size();     }     ans = calc(0, 1) + (a[0][0] ==  a  ? 1 : a[0][0] ==  b  ? -1 : 0);     if (ans)       if (ans > 0)         cout <<  FIRST ;       else         cout <<  SECOND ;     else       cout <<  DRAW ;     return 0;   }   