#include <bits/stdc++.h>   using namespace std;   const int mod = 1000000007;   typedef struct Cell {     int i;     int j;     int t;   } cell;   int n, k;   bool cmp(pair<int, int> a, pair<int, int> b) {     if (a.first < b.first)       return true;     else if (a.first == b.first && a.second < b.second)       return true;     return false;   }   bool check(int i, int j, pair<int, pair<int, int>> times[], int t) {     bool cond = false;     for (int tr = 0; tr < k; tr++) {       if (i == times[tr].first && j >= times[tr].second.first - 2 * t &&           j <= times[tr].second.second - 2 * t) {         cond = true;         break;       }     }     return cond;   }   int vis[3][100][101];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     int cases;     cin >> cases;     for (int T = 0; T < cases; T++) {       cin >> n >> k;       string arr[3];       for (int i = 0; i < 3; i++) {         cin >> arr[i];       }       int hi = -1, hj = -1;       for (int i = 0; i < 3; i++) {         for (int j = 0; j < n; j++) {           if (arr[i][j] ==  s ) {             hi = i;             hj = j;             break;           }         }         if (hi != -1) {           break;         }       }       pair<int, pair<int, int>> times[k];       int ind = 0;       for (int i = 0; i < 3; i++) {         for (int j = 0; j < n; j++) {           for (int t = 0; t < 101; t++) {             vis[i][j][t] = 0;           }         }       }       for (int i = 0; i < 3; i++)         for (int j = 0; j < n; j++) {           if (arr[i][j] >=  A  && arr[i][j] <=  Z ) {             int s = j;             int k = j;             while (k < n && arr[i][k] == arr[i][j]) k++;             int e = k - 1;             j = e;             times[ind].second.first = s;             times[ind].second.second = e;             times[ind].first = i;             ind++;           }         }       queue<cell> q;       cell node;       node.i = hi;       node.j = hj;       node.t = 0;       q.push(node);       bool cond = false;       while (q.size() > 0) {         auto p = q.front();         q.pop();         int i = p.i;         int j = p.j;         int t = p.t;         if (j == n - 1) {           cond = true;           break;         } else {           if (check(i, j, times, t)) continue;         }         if (j + 1 < n && !check(i, j + 1, times, t)) {           cell node;           node.i = i;           node.j = j + 1;           node.t = t + 1;           if (vis[i][j + 1][t + 1] == 0) {             q.push(node);             vis[i][j + 1][t + 1] = 1;           }           if ((i + 1 < 3) && (!check(i + 1, j + 1, times, t))) {             cell node;             node.i = i + 1;             node.j = j + 1;             node.t = t + 1;             if ((vis[i + 1][j + 1][t + 1] == 0)) {               vis[i + 1][j + 1][t + 1] = 1;               q.push(node);             }           }           if (i - 1 >= 0 && !check(i - 1, j + 1, times, t)) {             cell node;             node.i = i - 1;             node.j = j + 1;             node.t = t + 1;             if (vis[i - 1][j + 1][t + 1] == 0) {               vis[i - 1][j + 1][t + 1] = 1;               q.push(node);             }           }         }       }       if (cond)         cout <<  YES  << endl;       else         cout <<  NO  << endl;     }   }