#include <bits/stdc++.h>   using namespace std;   int n, k;   int y;   vector<pair<int, int> > p[3];   int dp[111][111][3];   bool check(int x, int t, int y) {     for (int i = 0; i < p[y].size(); i++) {       if (x >= p[y][i].first - 2 * t && x <= p[y][i].second - 2 * t) return false;     }     return true;   }   int go(int x, int t, int y) {     if (x == n - 1) return true;     int& res = dp[x][t][y];     if (res != -1) return res;     res = 0;     for (int i = 0; i < p[y].size(); i++) {       if (x >= p[y][i].first - 2 * t && x <= p[y][i].second - 2 * t ||           x + 1 >= p[y][i].first - 2 * t && x + 1 <= p[y][i].second - 2 * t)         return res = false;     }     if (check(x + 1, t, y)) res |= go(x + 1, t + 1, y);     if (check(x + 1, t, min(2, y + 1))) res |= go(x + 1, t + 1, min(2, y + 1));     if (check(x + 1, t, max(y - 1, 0))) res |= go(x + 1, t + 1, max(y - 1, 0));     return res;   }   void R(string s, int v) {     int i = 0;     if (s[0] ==  s ) {       y = v;       s[0] =  . ;     }     while (i < s.size()) {       if (s[i] !=  . ) {         int l = i;         int r = l;         while (i < s.size() && s[i] == s[l]) i++;         r = i - 1;         i--;         p[v].push_back(make_pair(l, r));         if (i == s.size() - 1) return;       }       i++;     }   }   int main() {     int t;     cin >> t;     for (int i = 0; i < t; i++) {       p[0].clear();       p[1].clear();       p[2].clear();       memset(dp, -1, sizeof(dp));       cin >> n >> k;       string s1, s2, s3;       cin >> s1 >> s2 >> s3;       R(s1, 0);       R(s2, 1);       R(s3, 2);       if (go(0, 0, y))         cout <<  YES  << endl;       else         cout <<  NO  << endl;     }     return 0;   }   