func_code_string: #include <bits/stdc++.h>   using namespace std;   pair<int, int> tc[30];   bool dp[5][110][505];   int vis[5][110][505], n, k, Trow[30], kase, stx, sty;   char mp[5][110];   bool solve(int x, int y, int mv) {     if (x < 1 || x > 3 || y < 1) return 0;     if (y > n) return 1;     bool oc1 = 0, oc2 = 0, oc3 = 0;     if (vis[x][y][mv] == kase) return dp[x][y][mv];     for (int i = 1; i <= k; i++) {       if (x == Trow[i]) {         if (y >= (tc[i].first - mv * 2) && y <= (tc[i].second - mv * 2)) return 0;         if (y + 1 >= (tc[i].first - mv * 2) && y + 1 <= (tc[i].second - mv * 2))           oc1 = 1;       } else if (x - Trow[i] == 1) {         if (y + 1 >= (tc[i].first - mv * 2) && y + 1 <= (tc[i].second - mv * 2))           oc2 = 1;       } else if (Trow[i] - x == 1) {         if (y + 1 >= (tc[i].first - mv * 2) && y + 1 <= (tc[i].second - mv * 2))           oc3 = 1;       }     }     bool op1 = 0, op2 = 0, op3 = 0;     if (!oc1) op1 = solve(x, y + 1, mv + 1);     if (!oc1 && !oc2) op2 = solve(x - 1, y + 1, mv + 1);     if (!oc1 && !oc3) op3 = solve(x + 1, y + 1, mv + 1);     vis[x][y][mv] = kase;     return dp[x][y][mv] = (op1 || op2 || op3);   }   int main() {     int ks;     scanf( %d , &ks);     for (kase = 1; kase <= ks; kase++) {       scanf( %d %d , &n, &k);       for (int i = 1; i <= 3; i++) scanf( %s , &mp[i][1]);       int cnt = 1;       for (int i = 1; i <= 3; i++) {         for (int j = 1; j <= n; j++) {           if (mp[i][j] ==  s )             stx = i, sty = j;           else if (mp[i][j] !=  . ) {             char S = mp[i][j];             int kk = j;             while (kk <= n && mp[i][kk] == S) mp[i][kk] =  . , kk++;             Trow[cnt] = i;             tc[cnt].first = j;             tc[cnt].second = kk - 1;             cnt++;           }         }       }       printf( %s n , solve(stx, sty, 0) ?  YES  :  NO );     }   }   