//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}
template<typename T>void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++){cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++){for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>vector<vector<T>>vec(ll x, ll y, T w){vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,-1,0,0,0,1,-1,-1};vector<ll>dy={0,0,1,-1,0,-1,1,-1};
template<typename T>vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<typename T1, typename T2>ostream &operator<<(ostream &os, const pair<T1, T2>&p){return os << p.first << " " << p.second;}
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v){for(auto &z:v)os << z << " ";cout<<"|"; return os;}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
int popcount(ll x){return __builtin_popcountll(x);};
int poplow(ll x){return __builtin_ctzll(x);};
int pophigh(ll x){return 63 - __builtin_clzll(x);};
void solve(){
	ll n,k;cin>>n>>k;
	vector<string>s(3);
	ll lim=n+5;
	auto dp=make_v(lim+1,3,n,false);
	rep(i,0,3){
		cin>>s[i];
		if(s[i][0]=='s'){
			s[i][0]='.';
			dp[0][i][0]=true;
		}
	}
	bool sw=false;
	rep(i,0,lim){
		rep(j,0,3){
			rep(o,0,n){
				if(!dp[i][j][o])continue;
				rep(q,0,5){
					ll x=j+dx[q],y=i+1;
					if(dy[q]==-1)continue;
					if(x<0||x>=3||y<0||y>=n)continue;
					if(2*i+y<n&&s[j][2*i+y]!='.')continue;
					if(2*i+y<n&&s[x][2*i+y]!='.')continue;
					if(2*(i+1)+y<n&&s[x][2*(i+1)+y]!='.')continue;
					if(i==n-2)sw=true;
					dp[i+1][x][y]=true;
				}
			}
		}
		//debug(dp[i+1],3,n);cout<<endl;
	}
	ans2(sw);
}
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
	ll t;cin>>t;
	while(t--){
		solve();
	}
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define _for(i,a,b) for(int i=(a);i<(b);++i)
#define ms(a) memset(a,0,sizeof(a))
#define ms_inf(a) memset(a,0x3f,sizeof(a))
#define ms_ninf(a) memset(a,0xcf,sizeof(a))
#define pb push_back
#define mp make_pair
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define lc (o<<1)
#define rc (o<<1|1)
typedef long long ll;
typedef unsigned long long ull;
int mod=1e9+7;
const ll INF=1ll<<60;
const int maxn=3e5+10;
const int maxl=100+10;
const double pi=acos(-1.0);
const double eps=1e-8;
struct train
{
	char c;
	pair<int,int>p;
	int len;
};
int n;
struct ma
{
	char s[3][maxl];
	inline bool ch(int j)
	{
		return j>=0&&j<n;
	}
	ma gen_nx()
	{
		vector<train>v;
		char w[3][maxl];memcpy(w,s,sizeof(w));
		_for(i,0,3)_for(j,0,n)if(w[i][j]=='s')w[i][j]='.';
		_for(i,0,3)
		{
			for(int j=0;j<n;)
			{
				if(isupper(w[i][j]))
				{
					int len=0;
					while(w[i][j+len]==w[i][j])++len;
					v.pb({w[i][j],{i,j},len});
					j+=len;
				}
				else ++j;
			}
		}
		ma ans;
		_for(i,0,3)_for(j,0,n)ans.s[i][j]='.';
		for(auto&ww:v)
		{
			char&c=ww.c;
			int bx=ww.p.first,by=ww.p.second-2;
			int len=ww.len;
			for(int j=by;j<by+len;++j)if(ch(j))ans.s[bx][j]=c;
		}
		return ans;
	}
	void ou()
	{
		_for(i,0,3)
		{
			_for(j,0,n)cout<<s[i][j];
			cout<<endl;
		}
		cout<<endl;
	}
}sta[110];
struct no
{
	int ti;
	pair<int,int>p;
	inline int gen()
	{
		int a=p.first*n+p.second;
		int b=ti;
		return b*n*3+a;
	}
};
set<int>tar;
int bx;
bool vis[maxn];
bool bfs()
{
	int by=0;
	pair<int,int>cp={bx,by};
	int ct=0;
	no beg{ct,cp};
	queue<no>q;ms(vis);
	int u=beg.gen();
	vis[u]=1;q.push(beg);
	while(!q.empty())
	{
		auto c=q.front();q.pop();
		assert(c.ti==c.p.second);
		if(tar.count(c.gen()))return 1;
		int ct=c.ti;
		int nt=ct+1;
		int cx=c.p.first,cy=c.p.second;
		++cy;
		if(cy>=n)continue;
		if(isupper(sta[ct].s[cx][cy]))continue;
		//up
		int nxx=cx-1;
		if(nxx>=0&&!isupper(sta[nt].s[nxx][cy])&&!isupper(sta[ct].s[nxx][cy]))
		{
			no nx{nt,{nxx,cy}};
			int yy=nx.gen();
			vis[yy]=1;
			q.push(nx);
		}
		nxx=cx;
		if(!isupper(sta[nt].s[nxx][cy])&&!isupper(sta[ct].s[nxx][cy]))
		{
			no nx{nt,{nxx,cy}};
			int yy=nx.gen();
			vis[yy]=1;
			q.push(nx);
		}
		nxx=cx+1;
		if(nxx<3&&!isupper(sta[nt].s[nxx][cy])&&!isupper(sta[ct].s[nxx][cy]))
		{
			no nx{nt,{nxx,cy}};
			int yy=nx.gen();
			vis[yy]=1;
			q.push(nx);
		}
	}
	return 0;
}
int main()
{
	fast;int T;cin>>T;
	while(T--)
	{
		ms(sta);
		int k;cin>>n>>k;
		_for(i,0,3)_for(j,0,n)cin>>sta[0].s[i][j];
		_for(i,0,3)
		{
			if(sta[0].s[i][0]=='s')bx=i;
		}
		_for(t,1,110)sta[t]=sta[t-1].gen_nx();
		_for(i,0,3)
		{
			int ti=n-1;
			pair<int,int>p={i,n-1};
			tar.insert(no{ti,p}.gen());
		}
		if(bfs())cout<<"YES";
		else cout<<"NO";
		cout<<"\n";
	}
}


#include<bits/stdc++.h>
using namespace std;
#define _for(i,a,b) for(int i=(a);i<(b);++i)
#define ms(a) memset(a,0,sizeof(a))
#define ms_inf(a) memset(a,0x3f,sizeof(a))
#define ms_ninf(a) memset(a,0xcf,sizeof(a))
#define pb push_back
#define mp make_pair
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define lc (o<<1)
#define rc (o<<1|1)
typedef long long ll;
typedef unsigned long long ull;
int mod=1e9+7;
const ll INF=1ll<<60;
const int maxn=3e5+10;
const int maxl=100+10;
const double pi=acos(-1.0);
const double eps=1e-8;
struct train
{
	char c;
	pair<int,int>p;
	int len;
};
int n;
struct ma
{
	char s[3][maxl];
	inline bool ch(int j)
	{
		return j>=0&&j<n;
	}
	ma gen_nx()
	{
		vector<train>v;
		char w[3][maxl];memcpy(w,s,sizeof(w));
		_for(i,0,3)_for(j,0,n)if(w[i][j]=='s')w[i][j]='.';
		_for(i,0,3)
		{
			for(int j=0;j<n;)
			{
				if(isupper(w[i][j]))
				{
					int len=0;
					while(w[i][j+len]==w[i][j])++len;
					v.pb({w[i][j],{i,j},len});
					j+=len;
				}
				else ++j;
			}
		}
		ma ans;
		_for(i,0,3)_for(j,0,n)ans.s[i][j]='.';
		for(auto&ww:v)
		{
			char&c=ww.c;
			int bx=ww.p.first,by=ww.p.second-2;
			int len=ww.len;
			for(int j=by;j<by+len;++j)if(ch(j))ans.s[bx][j]=c;
		}
		return ans;
	}
	void ou()
	{
		_for(i,0,3)
		{
			_for(j,0,n)cout<<s[i][j];
			cout<<endl;
		}
		cout<<endl;
	}
}sta[110];
struct no
{
	int ti;
	pair<int,int>p;
	inline int gen()
	{
		int a=p.first*n+p.second;
		int b=ti;
		return b*n*3+a;
	}
};
set<int>tar;
int bx;
bool vis[maxn];
bool bfs()
{
	int by=0;
	pair<int,int>cp={bx,by};
	int ct=0;
	no beg{ct,cp};
	queue<no>q;ms(vis);
	int u=beg.gen();
	vis[u]=1;q.push(beg);
	while(!q.empty())
	{
		auto c=q.front();q.pop();
		assert(c.ti==c.p.second);
		if(tar.count(c.gen()))return 1;
		int ct=c.ti;
		int nt=ct+1;
		int cx=c.p.first,cy=c.p.second;
		++cy;
		if(cy>=n)continue;
		if(isupper(sta[ct].s[cx][cy]))continue;
		//up
		int nxx=cx-1;
		if(nxx>=0&&!isupper(sta[nt].s[nxx][cy])&&!isupper(sta[ct].s[nxx][cy]))
		{
			no nx{nt,{nxx,cy}};
			int yy=nx.gen();
			if(!vis[yy])vis[yy]=1,q.push(nx);
		}
		nxx=cx;
		if(!isupper(sta[nt].s[nxx][cy])&&!isupper(sta[ct].s[nxx][cy]))
		{
			no nx{nt,{nxx,cy}};
			int yy=nx.gen();
			if(!vis[yy])vis[yy]=1,q.push(nx);
		}
		nxx=cx+1;
		if(nxx<3&&!isupper(sta[nt].s[nxx][cy])&&!isupper(sta[ct].s[nxx][cy]))
		{
			no nx{nt,{nxx,cy}};
			int yy=nx.gen();
			if(!vis[yy])vis[yy]=1,q.push(nx);
		}
	}
	return 0;
}
int main()
{
	fast;int T;cin>>T;
	while(T--)
	{
		ms(sta);tar.clear();
		int k;cin>>n>>k;
		_for(i,0,3)_for(j,0,n)cin>>sta[0].s[i][j];
		_for(i,0,3)
		{
			if(sta[0].s[i][0]=='s')bx=i;
		}
		_for(t,1,110)sta[t]=sta[t-1].gen_nx();
		_for(i,0,3)
		{
			int ti=n-1;
			pair<int,int>p={i,n-1};
			tar.insert(no{ti,p}.gen());
		}
		if(bfs())cout<<"YES";
		else cout<<"NO";
		cout<<"\n";
	}
}


#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fo(i,a,b) for(int i=a;i<b;i++)
#define fo_(i,a,b) for(int i=a;i>b;i--)
#define M(a) memset(a,0,sizeof a)
#define M_(a) memset(a ,-1,sizeof a)
#define pb push_back
#define PI 3.14159265
#define nmax 110
const ll inf = std::numeric_limits<ll>::max();
using namespace std;
const ll mod = 1e9+7;

int n;
string st[3];
bool seen[3][nmax];

bool dfs(int i,int p){
    seen[p][i] = true;
    bool g = false;
    if (i >= n){
        return true;
    }
    if ((i+3 >= n || st[p][i+3] == '.') && (i+1 >= n || st[p][i+1] == '.') && (i+2 >= n || st[p][i+2] == '.')){
        if (!seen[p][i+3]) g |= dfs(i+3,p);
    }
    if (p != 2 && (i >= n || st[p+1][i] == '.') && (i+3 >= n || st[p+1][i+3] == '.') && (i+1 >= n || st[p+1][i+1] == '.') && (i+2 >= n || st[p+1][i+2] == '.')){
        if (!seen[p+1][i+3]) g |= dfs(i+3,p+1);
    }
    if (p != 0 && (i >= n || st[p-1][i] == '.')  && (i+3 >= n || st[p-1][i+3] == '.') && (i+1 >= n || st[p-1][i+1] == '.') && (i+2 >= n || st[p-1][i+2] == '.')){
        if (!seen[p-1][i+3]) g |= dfs(i+3,p-1);
    }
    return g;

}

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >> t;
    while (t--){

        int k;
        cin >> n >> k;
        cin >> st[0] >> st[1] >> st[2];
        int p;
        if (st[0][0] == 's'){
            if (st[0][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[0][1] = 's';
            p = 0;
        }else if (st[1][0] == 's'){
            if (st[1][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[1][1] = 's';
            p = 1;
        }else{
            if (st[2][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[2][1] = 's';
            p = 2;
        }

        if (dfs(1,p)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }

    }

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fo(i,a,b) for(int i=a;i<b;i++)
#define fo_(i,a,b) for(int i=a;i>b;i--)
#define M(a) memset(a,0,sizeof a)
#define M_(a) memset(a ,-1,sizeof a)
#define pb push_back
#define PI 3.14159265
#define nmax 110
const ll inf = std::numeric_limits<ll>::max();
using namespace std;
const ll mod = 1e9+7;

int n;
string st[3];
bool seen[3][nmax];

bool dfs(int i,int p){
    seen[p][i] = true;
    bool g = false;
    if (i >= n-1){
        return true;
    }
    if (st[p][i+1] != '.'){
        return false;
    }
    i++;
    if ((i+1 >= n || st[p][i+1] == '.') && (i+2 >= n || st[p][i+2] == '.')){
        if (!seen[p][i+2]) g = g || dfs(i+2,p);
    }
    if (p != 2 && (i >= n || st[p+1][i] == '.') && (i+1 >= n || st[p+1][i+1] == '.') && (i+2 >= n || st[p+1][i+2] == '.')){
        if (!seen[p+1][i+2]) g = g || dfs(i+2,p+1);
    }
    if (p != 0 && (i >= n || st[p-1][i] == '.') && (i+1 >= n || st[p-1][i+1] == '.') && (i+2 >= n || st[p-1][i+2] == '.')){
        if (!seen[p-1][i+2]) g = g || dfs(i+2,p-1);
    }
    return g;

}

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >> t;
    while (t--){

        int k;
        M(seen);
        cin >> n >> k;
        cin >> st[0] >> st[1] >> st[2];
        int p;
        if (st[0][0] == 's'){
            p = 0;
        }else if (st[1][0] == 's'){
            p = 1;
        }else{
            p = 2;
        }

        if (dfs(0,p)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }

    }

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fo(i,a,b) for(int i=a;i<b;i++)
#define fo_(i,a,b) for(int i=a;i>b;i--)
#define M(a) memset(a,0,sizeof a)
#define M_(a) memset(a ,-1,sizeof a)
#define pb push_back
#define PI 3.14159265
#define nmax 110
const ll inf = std::numeric_limits<ll>::max();
using namespace std;
const ll mod = 1e9+7;

int n;
string st[3];
bool seen[3][nmax];

bool dfs(int i,int p){
    seen[p][i] = true;
    bool g = false;
    if (i >= n){
        return true;
    }
    if ((i+3 >= n || st[p][i+3] == '.') && (i+1 >= n || st[p][i+1] == '.') && (i+2 >= n || st[p][i+2])){
        if (!seen[p][i+3]) g |= dfs(i+3,p);
    }
    if (p != 2 && (i+3 >= n || st[p+1][i+3] == '.') && (i+1 >= n || st[p+1][i+1] == '.') && (i+2 >= n || st[p+1][i+2])){
        if (!seen[p+1][i+3]) g |= dfs(i+3,p);
    }
    if (p != 0 && (i+3 >= n || st[p-1][i+3] == '.') && (i+1 >= n || st[p-1][i+1] == '.') && (i+2 >= n || st[p-1][i+2])){
        if (!seen[p+1][i+3]) g |= dfs(i+3,p);
    }
    return g;

}

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >> t;
    while (t--){

        int k;
        cin >> n >> k;
        cin >> st[0] >> st[1] >> st[2];
        int p;
        if (st[0][0] == 's'){
            if (st[0][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[0][1] = 's';
            p = 0;
        }else if (st[1][0] == 's'){
            if (st[1][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[1][1] = 's';
            p = 1;
        }else{
            if (st[2][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[2][1] = 's';
            p = 2;
        }

        if (dfs(1,p)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }

    }

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fo(i,a,b) for(int i=a;i<b;i++)
#define fo_(i,a,b) for(int i=a;i>b;i--)
#define M(a) memset(a,0,sizeof a)
#define M_(a) memset(a ,-1,sizeof a)
#define pb push_back
#define PI 3.14159265
#define nmax 110
const ll inf = std::numeric_limits<ll>::max();
using namespace std;
const ll mod = 1e9+7;

int n;
string st[3];
bool seen[3][nmax];

bool dfs(int i,int p){
    seen[p][i] = true;
    bool g = false;
    if (i >= n-1){
        return true;
    }

    if (st[p][i+1] != '.'){
        return false;
    }
    i++;
    if ((i+1 >= n || st[p][i+1] == '.') && (i+2 >= n || st[p][i+2] == '.')){
        if (!seen[p][i+2]) g = g || dfs(i+2,p);
    }
    if (p != 2 && (i >= n || st[p+1][i] == '.') && (i+1 >= n || st[p+1][i+1] == '.') && (i+2 >= n || st[p+1][i+2] == '.')){
        if (!seen[p+1][i+2]) g = g || dfs(i+2,p+1);
    }
    if (p != 0 && (i >= n || st[p-1][i] == '.') && (i+1 >= n || st[p-1][i+1] == '.') && (i+2 >= n || st[p-1][i+2] == '.')){
        if (!seen[p-1][i+2]) g = g || dfs(i+2,p-1);
    }
    return g;

}

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >> t;
    while (t--){

        int k;
        cin >> n >> k;
        cin >> st[0] >> st[1] >> st[2];
        int p;
        if (st[0][0] == 's'){
            if (st[0][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            p = 0;
        }else if (st[1][0] == 's'){
            if (st[1][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            p = 1;
        }else{
            if (st[2][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            p = 2;
        }

        if (dfs(0,p)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }

    }

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fo(i,a,b) for(int i=a;i<b;i++)
#define fo_(i,a,b) for(int i=a;i>b;i--)
#define M(a) memset(a,0,sizeof a)
#define M_(a) memset(a ,-1,sizeof a)
#define pb push_back
#define PI 3.14159265
#define nmax 110
const ll inf = std::numeric_limits<ll>::max();
using namespace std;
const ll mod = 1e9+7;

int n;
string st[3];
bool seen[3][nmax];

bool dfs(int i,int p){
    seen[p][i] = true;
    bool g = false;
    if (i >= n-1){
        return true;
    }
    if (st[p][i+1] != '.'){
        return false;
    }
    i++;
    if ((i+1 >= n || st[p][i+1] == '.') && (i+2 >= n || st[p][i+2] == '.')){
        if (!seen[p][i+2]) g = g || dfs(i+2,p);
    }
    if (p != 2 && (i >= n || st[p+1][i] == '.') && (i+1 >= n || st[p+1][i+1] == '.') && (i+2 >= n || st[p+1][i+2] == '.')){
        if (!seen[p+1][i+2]) g = g || dfs(i+2,p+1);
    }
    if (p != 0 && (i >= n || st[p-1][i] == '.') && (i+1 >= n || st[p-1][i+1] == '.') && (i+2 >= n || st[p-1][i+2] == '.')){
        if (!seen[p-1][i+2]) g = g || dfs(i+2,p-1);
    }
    return g;

}

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >> t;
    while (t--){

        int k;
        cin >> n >> k;
        cin >> st[0] >> st[1] >> st[2];
        int p;
        if (st[0][0] == 's'){
            p = 0;
        }else if (st[1][0] == 's'){
            p = 1;
        }else{
            p = 2;
        }

        if (dfs(0,p)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }

    }

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fo(i,a,b) for(int i=a;i<b;i++)
#define fo_(i,a,b) for(int i=a;i>b;i--)
#define M(a) memset(a,0,sizeof a)
#define M_(a) memset(a ,-1,sizeof a)
#define pb push_back
#define PI 3.14159265
#define nmax 110
const ll inf = std::numeric_limits<ll>::max();
using namespace std;
const ll mod = 1e9+7;

int n;
string st[3];
bool seen[3][nmax];

bool dfs(int i,int p){
    seen[p][i] = true;
    bool g = false;
    if (i >= n){
        return true;
    }
    if ((i >= n || st[p][i] == '.') && (i+3 >= n || st[p][i+3] == '.') && (i+1 >= n || st[p][i+1] == '.') && (i+2 >= n || st[p][i+2])){
        if (!seen[p][i+3]) g |= dfs(i+3,p);
    }
    if (p != 2 && (i >= n || st[p+1][i] == '.') && (i+3 >= n || st[p+1][i+3] == '.') && (i+1 >= n || st[p+1][i+1] == '.') && (i+2 >= n || st[p+1][i+2])){
        if (!seen[p+1][i+3]) g |= dfs(i+3,p+1);
    }
    if (p != 0 && (i >= n || st[p-1][i] == '.')  && (i+3 >= n || st[p-1][i+3] == '.') && (i+1 >= n || st[p-1][i+1] == '.') && (i+2 >= n || st[p-1][i+2])){
        if (!seen[p-1][i+3]) g |= dfs(i+3,p-1);
    }
    return g;

}

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >> t;
    while (t--){

        int k;
        cin >> n >> k;
        cin >> st[0] >> st[1] >> st[2];
        int p;
        if (st[0][0] == 's'){
            if (st[0][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[0][1] = 's';
            p = 0;
        }else if (st[1][0] == 's'){
            if (st[1][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[1][1] = 's';
            p = 1;
        }else{
            if (st[2][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[2][1] = 's';
            p = 2;
        }

        if (dfs(1,p)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }

    }

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fo(i,a,b) for(int i=a;i<b;i++)
#define fo_(i,a,b) for(int i=a;i>b;i--)
#define M(a) memset(a,0,sizeof a)
#define M_(a) memset(a ,-1,sizeof a)
#define pb push_back
#define PI 3.14159265
#define nmax 110
const ll inf = std::numeric_limits<ll>::max();
using namespace std;
const ll mod = 1e9+7;

int n;
string st[3];
bool seen[3][nmax];

bool dfs(int i,int p){
    seen[p][i] = true;
    bool g = false;
    if (i >= n){
        return true;
    }
    if ((i+3 >= n || st[p][i+3] == '.') && (i+1 >= n || st[p][i+1] == '.') && (i+2 >= n || st[p][i+2])){
        if (!seen[p][i+3]) g |= dfs(i+3,p);
    }
    if (p != 2 && (i >= n || st[p+1][i] == '.') && (i+3 >= n || st[p+1][i+3] == '.') && (i+1 >= n || st[p+1][i+1] == '.') && (i+2 >= n || st[p+1][i+2])){
        if (!seen[p+1][i+3]) g |= dfs(i+3,p+1);
    }
    if (p != 0 && (i >= n || st[p-1][i] == '.')  && (i+3 >= n || st[p-1][i+3] == '.') && (i+1 >= n || st[p-1][i+1] == '.') && (i+2 >= n || st[p-1][i+2])){
        if (!seen[p-1][i+3]) g |= dfs(i+3,p-1);
    }
    return g;

}

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >> t;
    while (t--){

        int k;
        cin >> n >> k;
        cin >> st[0] >> st[1] >> st[2];
        int p;
        if (st[0][0] == 's'){
            if (st[0][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[0][1] = 's';
            p = 0;
        }else if (st[1][0] == 's'){
            if (st[1][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[1][1] = 's';
            p = 1;
        }else{
            if (st[2][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[2][1] = 's';
            p = 2;
        }

        if (dfs(1,p)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }

    }

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fo(i,a,b) for(int i=a;i<b;i++)
#define fo_(i,a,b) for(int i=a;i>b;i--)
#define M(a) memset(a,0,sizeof a)
#define M_(a) memset(a ,-1,sizeof a)
#define pb push_back
#define PI 3.14159265
#define nmax 110
const ll inf = std::numeric_limits<ll>::max();
using namespace std;
const ll mod = 1e9+7;

int n;
string st[3];
bool seen[3][nmax];

bool dfs(int i,int p){
    seen[p][i] = true;
    bool g = false;
    if (i >= n){
        return true;
    }
    if ((i+3 >= n || st[p][i+3] == '.') && (i+1 >= n || st[p][i+1] == '.') && (i+2 >= n || st[p][i+2])){
        if (!seen[p][i+3]) g |= dfs(i+3,p);
    }
    if (p != 2 && (i+3 >= n || st[p+1][i+3] == '.') && (i+1 >= n || st[p+1][i+1] == '.') && (i+2 >= n || st[p+1][i+2])){
        if (!seen[p+1][i+3]) g |= dfs(i+3,p+1);
    }
    if (p != 0 && (i+3 >= n || st[p-1][i+3] == '.') && (i+1 >= n || st[p-1][i+1] == '.') && (i+2 >= n || st[p-1][i+2])){
        if (!seen[p-1][i+3]) g |= dfs(i+3,p-1);
    }
    return g;

}

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin >> t;
    while (t--){

        int k;
        cin >> n >> k;
        cin >> st[0] >> st[1] >> st[2];
        int p;
        if (st[0][0] == 's'){
            if (st[0][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[0][1] = 's';
            p = 0;
        }else if (st[1][0] == 's'){
            if (st[1][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[1][1] = 's';
            p = 1;
        }else{
            if (st[2][1] != '.'){
                cout << "NO" << endl;
                continue;
            }
            st[2][1] = 's';
            p = 2;
        }

        if (dfs(1,p)){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }

    }

    return 0;
}


#ifdef ONPC
# define _GLIBCXX_DEBUG
#define deb(a) cerr << "nu smotri pidor " << #a << " = " << a << endl;
#else
#define deb(a)
#endif
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef long double ld;
ll MOD = 1e9 + 7;
ll t, n;
char pl[3][101][11];
ll used[3][101][11];

bool gd(pair<ll, ll> b){
    if (0 <= b.first && b.first <= 2){
        return pl[b.first][b.second][t] == '.';
    }
    return false;
}

void dfs(pair<ll, ll> a){
    //cout << a.first << "  " << a.second << endl;
    used[a.first][a.second][t] = 1;
    if (a.second == n - 1){
        return;
    }
    pair<ll, ll> to = {a.first, min(a.second + 3, n - 1)};
    if (gd({a.first, a.second + 1})) {
        ///cout << "suk";
        if (gd({to.first, to.second - 2}) && gd({to.first, to.second - 1}) && gd(to)) {
            dfs(to);
        }
        to.first += 1;
        if (gd({to.first, to.second - 2}) && gd({to.first, to.second - 1}) && gd(to)) {
            dfs(to);
        }
        to.first -= 2;
        if (gd({to.first, to.second - 2}) && gd({to.first, to.second - 1}) && gd(to)) {
            dfs(to);
        }
    }
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout << fixed << setprecision(20);
    cin >> t;
    while (t--){
        ll k;
        cin >> n >> k;
        pair<ll, ll> st;
        for (int i = 0; i < 3; i++){
            for (int j = 0; j < n; j++){
                cin >> pl[i][j][t];
                if (pl[i][j][t] == 's'){
                    pl[i][j][t] = '.';
                    st = {i, j};
                }
            }
        }
        dfs(st);
        if (used[0][n - 1][t] || used[1][n - 1][t] || used[2][n - 1][t]){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }

#ifdef ONPC
    cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}
//egor lox


#ifdef ONPC
# define _GLIBCXX_DEBUG
#define deb(a) cerr << "nu smotri pidor " << #a << " = " << a << endl;
#else
#define deb(a)
#endif
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef long double ld;
ll MOD = 1e9 + 7;
ll t, n;
char pl[3][101][11];
ll used[3][101][11];

bool gd(pair<ll, ll> b){
    if (0 <= b.first && b.first <= 2){
        return pl[b.first][b.second][t] == '.';
    }
    return false;
}

void dfs(pair<ll, ll> a){
    //cout << a.first << "  " << a.second << endl;
    used[a.first][a.second][t] = 1;
    if (a.second == n - 1){
        return;
    }
    pair<ll, ll> to = {a.first, min(a.second + 3, n - 1)};
    if (gd({a.first, a.second + 1})) {
        ///cout << "suk";
        if (gd({to.first, to.second - 2}) && gd({to.first, to.second - 1}) && gd(to)) {
            if (!used[to.first][to.second][t])
                dfs(to);
        }
        to.first += 1;
        if (gd({to.first, to.second - 2}) && gd({to.first, to.second - 1}) && gd(to)) {
            if (!used[to.first][to.second][t])
                dfs(to);
        }
        to.first -= 2;
        if (gd({to.first, to.second - 2}) && gd({to.first, to.second - 1}) && gd(to)) {
            if (!used[to.first][to.second][t])
                dfs(to);
        }
    }
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout << fixed << setprecision(20);
    cin >> t;
    while (t--){
        ll k;
        cin >> n >> k;
        pair<ll, ll> st;
        for (int i = 0; i < 3; i++){
            for (int j = 0; j < n; j++){
                cin >> pl[i][j][t];
                if (pl[i][j][t] == 's'){
                    pl[i][j][t] = '.';
                    st = {i, j};
                }
            }
        }
        dfs(st);
        if (used[0][n - 1][t] || used[1][n - 1][t] || used[2][n - 1][t]){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }

#ifdef ONPC
    cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}
//egor lox


#pragma region Macros
#pragma GCC optimize("O3")
#pragma GCC target("avx2,avx")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define VEC(type, name, size)                                                                                \
    vector<type> name(size);                                                                                \
    IN(name)
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define VV(type, name, h, w)                                                                                \
    vector<vector<type>> name(h, vector<type>(w));                                                                                \
    IN(name)
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...)                                                                                \
    vector<vector<vector<vector<type>>>> name(a, vector<vector<vector<type>>>(b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
using namespace std;
string YES[2] = {"NO", "YES"};
string Yes[2] = {"No", "Yes"};
string yes[2] = {"no", "yes"};
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define si(c) (int)(c).size()
#define INT(...)                                                                                \
    int __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LL(...)                                                                                \
    ll __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define STR(...)                                                                                \
    string __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define CHR(...)                                                                                \
    char __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define DBL(...)                                                                                \
    double __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
int scan() { return getchar(); }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(string &a) { cin >> a; }
template <class T, class S> void scan(pair<T, S> &p) { scan(p.first), scan(p.second); }
template <class T> void scan(vector<T> &);
template <class T> void scan(vector<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) {
    scan(head);
    IN(tail...);
}
template <class T, class S> inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T, class S> inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
vi iota(int n) {
    vi a(n);
    iota(all(a), 0);
    return a;
}
template <typename T> vi iota(vector<T> &a, bool greater = false) {
    vi res(a.size());
    iota(all(res), 0);
    sort(all(res), [&](int i, int j) {
        if(greater) return a[i] > a[j];
        return a[i] < a[j];
    });
    return res;
}
#define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end())
vector<pll> factor(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.push_back({i, 1});
            while((x /= i) % i == 0) ans.back().second++;
        }
    if(x != 1) ans.push_back({x, 1});
    return ans;
}
template <class T> vector<T> divisor(T x) {
    vector<T> ans;
    for(T i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
template <typename T> void zip(vector<T> &x) {
    vector<T> y = x;
    sort(all(y));
    for(int i = 0; i < x.size(); ++i) { x[i] = lb(y, x[i]); }
}
int popcount(ll x) { return __builtin_popcountll(x); }
struct Setup_io {
    Setup_io() {
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        cout << fixed << setprecision(15);
    }
} setup_io;
int in() {
    int x;
    cin >> x;
    return x;
}
ll lin() {
    unsigned long long x;
    cin >> x;
    return x;
}

template <typename T> struct edge {
    int from, to;
    T cost;
    int id;
    edge(int to, T cost) : from(-1), to(to), cost(cost) {}
    edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
    edge(int from, int to, T cost, int id) : from(from), to(to), cost(cost), id(id) {}
    edge &operator=(const int &x) {
        to = x;
        return *this;
    }
    operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;

using Tree = vector<vector<int>>;
using Graph = vector<vector<int>>;
template <class T> using Wgraph = vector<vector<edge<T>>>;
Graph getG(int n, int m = -1, bool directed = false, int margin = 1) {
    Tree res(n);
    if(m == -1) m = n - 1;
    while(m--) {
        int a, b;
        cin >> a >> b;
        a -= margin, b -= margin;
        res[a].emplace_back(b);
        if(!directed) res[b].emplace_back(a);
    }
    return move(res);
}
template <class T> Wgraph<T> getWg(int n, int m = -1, bool directed = false, int margin = 1) {
    Wgraph<T> res(n);
    if(m == -1) m = n - 1;
    while(m--) {
        int a, b;
        T c;
        cin >> a >> b >> c;
        a -= margin, b -= margin;
        res[a].emplace_back(b, c);
        if(!directed) res[b].emplace_back(a, c);
    }
    return move(res);
}

#define i128 __int128_t
#define ull unsigned long long int
#define TEST                                                                                \
    INT(testcases);                                                                                \
    while(testcases--)
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    for(auto &e : v) cout << e << " ";
    cout << endl;
    return os;
}
template <class T, class S> ostream &operator<<(ostream &os, const pair<T, S> &p) {
    cout << "(" << p.fi << ", " << p.se << ")";
    return os;
}
template <class S, class T> string to_string(pair<S, T> p) { return "(" + to_string(p.first) + "," + to_string(p.second) + ")"; }
template <class A> string to_string(A v) {
    if(v.empty()) return "{}";
    string ret = "{";
    for(auto &x : v) ret += to_string(x) + ",";
    ret.back() = '}';
    return ret;
}

void dump() { cerr << endl; }
template <class Head, class... Tail> void dump(Head head, Tail... tail) {
    cerr << to_string(head) << " ";
    dump(tail...);
}
#define endl '\n'
#ifdef _LOCAL
#undef endl
#define debug(x)                                                                                \
    cout << #x << ": ";                                                                                \
    dump(x)
#else
#define debug(x)
#endif
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int rnd(int n) { return uniform_int_distribution<int>(0, n - 1)(rng); }
// ll rndll(ll n) { return uniform_int_distribution<ll>(0, n - 1)(rng); }

template <typename T> static constexpr T inf = numeric_limits<T>::max() / 2;
#pragma endregion

int main() {
    TEST {
        INT(n, k);
        VV(char, a, 3, n);
        rep(i, 3) rep(_, 3) a[i].eb('.');
        int st = 0;
        rep(i, 3) if(a[i][0] == 's') st = i;
        auto ins = [&](int i, int j) { return 0 <= min(i, j) and i < 3 and j < n + 2; };
        vv(int, dp, 3, n + 3);
        dp[st][0] = true;
        rep(j, n) {
            rep(i, 3) {
                if(!dp[i][j]) continue;
                if(a[i][j + 1] != '.') continue;
                rep2(k, -1, 1) {
                    if(0 <= i + k and i + k < 3) {
                        if(a[i + k][j + 1] == '.' and a[i + k][j + 2] == '.' and a[i + k][j + 3] == '.') dp[i + k][j + 3] = true;
                    }
                }
            }
        }
        bool flag = false;
        rep2(j, n, n + 2) rep(i, 3) flag |= dp[i][j];
        cout << YES[flag] << endl;
    }
}


# include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("Ofast")
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define int long long
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pll;

# define S second
# define F first
# define kill(x) return(cout << x << '\n', 0LL)
# define debug(x) cerr<< #x << " = " << x << endl
# define ddebug(x, y) cerr<< #x << " = " << x  << ", " << #y << " = " << y << endl
# define tdebug(x, y, z) cerr<< #x << " = " << x  << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
# define bin(x) cerr<< #x << " : " << bitset<4>(x) << endl
# define sz(s) (int)s.size()
# define sq(x) (x) * (x)
# define PB(x) push_back(x)
# define smax(x, y) (x) = max((x), (y))
# define smin(x, y) (x) = min((x), (y))
# define all(x) x.begin(), x.end()
# define SP fixed << setprecision(10)
# define MP make_pair
# define uop(x, y) pii(min(x, y), max(x, y))

const int MAXN = 100 + 10;
char c[5][MAXN], dp[5][MAXN];

void solve()
{
	int n, _;
	cin >> n >> _;
	for (int i = 0; i < 3; i ++)
		for (int j = 0; j < n; j ++)
			cin >> c[i][j];

	memset(dp, 0, sizeof dp);
	for (int i = 0; i < 3; i ++)
		if (c[i][0] == 's')
			dp[i][0] = true;

	for (int i = 1; i < n; i ++)
		for (int j = 0; j < 3; j ++)
		{
			if (c[j][i] != '.')
			{
				dp[j][i] = 0;
				continue;
			}

			if (i % 3 == 1)
			{
				for (int k = -1; k <= 1; k ++)
					if (j + k < 3 && j + k >= 0)
						dp[j][i] |= dp[j + k][i - 1] && (c[j + k][i] == '.');
			}
			else
				dp[j][i] |= dp[j][i - 1];
		}
	cout << ((dp[0][n - 1] || dp[1][n - 1] || dp[2][n - 1]) ? "YES" : "NO") << '\n';

}

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	int t;
	cin >> t;
	while (t --)
		solve();

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define sz(x) (int)(x.size())
#define FOR(x,y,z) for(int x = y; x <= z; x++)
#define int long long

const int N = 102, inf = 1e18;

int n, k;
char mat[4][N];
bool hasTrain[4][N][N];

void solve();

bool go(int row, int col, int time) {
    if(row < 1 || row > 3 || hasTrain[row][col][time])
        return 0;
    if(col == n)
        return true;
    bool ans = false;

    if(hasTrain[row][col + 1][time] == false)   //right direction
    {
        bool choice1 = go(row, col + 1, time + 1);  //stay there
        if(choice1)
            ans = true;

        if(hasTrain[row - 1][col + 1][time] == false)   // go up
        {
            bool choice2 = go(row - 1, col + 1, time + 1);
            if(choice2)
                ans = true;
        }

        if(hasTrain[row + 1][col + 1][time] == false)   //go down
        {
            bool choice3 = go(row + 1, col + 1, time + 1);
            if(choice3)
                ans = true;
        }
    }
    return ans;
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    int tt = 1;
    cin >> tt;
    while(tt--){
        solve();
    }
}

void solve(){

    memset(hasTrain, false, sizeof(hasTrain));

    cin >> n >> k;
    int startRow = -1;

    FOR(i,1,3) FOR(j,1,n) {
        cin >> mat[i][j];
        if(mat[i][j] == 's') {
            startRow = i;
        }
        if(mat[i][j] >= 'A' && mat[i][j] <= 'Z') {
            int time = 0, pos = j;
            while(pos >= 1) {
                hasTrain[i][pos][time] = true;
                time++;
                pos -= 2;
            }
        }
    }

    bool ans = go(startRow, 1, 0);
    if(ans == true) {
        cout << "YES" << '\n';
    }else {
        cout << "NO" << '\n';
    }
}


#include <bits/stdc++.h>
using namespace std;

#define sz(x) (int)(x.size())
#define FOR(x,y,z) for(int x = y; x <= z; x++)
#define int long long

const int N = 102, inf = 1e18;

int n, k;
char mat[4][N];
bool hasTrain[4][N][N];
int dp[4][N][N];

void solve();

//time complexity : distinct_states * (work per each distinct_state)
                // 4 * N * N = O(N * N)

bool go(int row, int col, int time) {   //exponential
    if(row < 1 || row > 3 || hasTrain[row][col][time])
        return 0;
    if(col == n)
        return true;

    if(dp[row][col][time] != -1)
        return dp[row][col][time];

    bool ans = false;

    if(hasTrain[row][col + 1][time] == false)   //right direction
        //constant time work
    {
        bool choice1 = go(row, col + 1, time + 1);  //stay there
        if(choice1)
            ans = true;

        if(hasTrain[row - 1][col + 1][time] == false)   // go up
        {
            bool choice2 = go(row - 1, col + 1, time + 1);
            if(choice2)
                ans = true;
        }

        if(hasTrain[row + 1][col + 1][time] == false)   //go down
        {
            bool choice3 = go(row + 1, col + 1, time + 1);
            if(choice3)
                ans = true;
        }
    }

    dp[row][col][time] = ans;

    return ans;
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    int tt = 1;
    cin >> tt;
    while(tt--){
        solve();
    }
}

void solve(){

    memset(hasTrain, false, sizeof(hasTrain));
    memset(dp, -1, sizeof(dp));

    cin >> n >> k;
    int startRow = -1;

    FOR(i,1,3) FOR(j,1,n) {
        cin >> mat[i][j];
        if(mat[i][j] == 's') {
            startRow = i;
        }
        if(mat[i][j] >= 'A' && mat[i][j] <= 'Z') {
            int time = 0, pos = j;
            while(pos >= 1) {
                hasTrain[i][pos][time] = true;
                time++;
                pos -= 2;
            }
        }
    }

    bool ans = go(startRow, 1, 0);
    if(ans == true) {
        cout << "YES" << '\n';
    }else {
        cout << "NO" << '\n';
    }
}


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<int,int> pii;
typedef vector<int> vi;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define meme(x,y) memset(x, y, sizeof x)
#define pb push_back
#define mp make_pair

#ifdef _DEBUG
#define debug_text(...) printf(__VA_ARGS__)
#else
#define debug_text(...) /* --- NOTHING --- */
#endif

const int mod = 1e9+7;
const ll INF = ll(1e18);
const int inf = numeric_limits<int>::max();
const int N = 105;

int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

char graph[3][N];
int n, k, t;

struct P {
	int x, y, move;
	P(int _x, int _y, int _move) : x(_x), y(_y), move(_move) {}
};

bool valid(int x, int y) {
	if (x >= 0 && x < 3 && y >= 0 && y < n) return true;
	return false;
}

bool dfs (int a, int b) {
	stack<P> q;
	q.push(P(a,b,0));
	while (not q.empty()) {
		P u = q.top(); q.pop();
		if (u.y == n-1 && graph[u.x][u.y] == '.') return true;
		if (isupper(graph[u.x][u.y])) continue;
		if (u.move%4 == 0 && valid(u.x,u.y-2) && isupper(graph[u.x][u.y-1])) continue;
		if (u.move%4 == 1) {
			q.push(P(u.x,u.y,u.move+1));
			if (valid(u.x+1,u.y)) q.push(P(u.x+1,u.y,u.move+1));
			if (valid(u.x-1,u.y)) q.push(P(u.x-1,u.y,u.move+1));
		} else {
			if (u.move%4 == 0) q.push(P(u.x, u.y+1, u.move+1));
			else q.push(P(u.x, u.y+2, u.move+2));
		}
	}
	return false;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> t;

	while (t--) {
		cin >> n >> k;
		for (int i = 0; i < 3; i++)
			for (int j = 0; j < n; j++) cin >> graph[i][j];

		for (int i = 0; i < 3; i++) {
			if (graph[i][0] == 's') cout << (dfs(i,0) ? "YES\n" : "NO\n");
		}

	}
    return 0;
}
// notes
//


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<int,int> pii;
typedef vector<int> vi;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define meme(x,y) memset(x, y, sizeof x)
#define pb push_back
#define mp make_pair

#ifdef _DEBUG
#define debug_text(...) printf(__VA_ARGS__)
#else
#define debug_text(...) /* --- NOTHING --- */
#endif

const int mod = 1e9+7;
const ll INF = ll(1e18);
const int inf = numeric_limits<int>::max();
const int N = 105;

int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

char graph[3][N];
int n, k, t;

struct P {
	int x, y, move;
	P(int _x, int _y, int _move) : x(_x), y(_y), move(_move) {}
};

bool valid(int x, int y) {
	if (x >= 0 && x < 3 && y >= 0 && y < n) return true;
	return false;
}

bool dfs (int a, int b) {
	stack<P> q;
	q.push(P(a,b,0));
	while (not q.empty()) {
		P u = q.top(); q.pop();
		if (u.y == n-1 && graph[u.x][u.y] == '.') return true;
		if (isupper(graph[u.x][u.y])) continue;
		if (u.move%4 == 0 && valid(u.x,u.y-2) && isupper(graph[u.x][u.y-1])) continue;
		if (u.move%4 == 1) {
			q.push(P(u.x,u.y,u.move+1));
			if (valid(u.x+1,u.y)) q.push(P(u.x+1,u.y,u.move+1));
			if (valid(u.x-1,u.y)) q.push(P(u.x-1,u.y,u.move+1));
		} else {
			if (u.move%4 == 0) q.push(P(u.x, u.y+1, u.move+1));
			else q.push(P(u.x, u.y+2, u.move+2));
		}
	}
	return false;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> t;

	while (t--) {
		cin >> n >> k;
		for (int i = 0; i < 3; i++) cin >> graph[i];
		for (int i = 0; i < 3; i++) {
			if (graph[i][0] == 's') cout << (dfs(i,0) ? "YES\n" : "NO\n");
		}

	}
    return 0;
}
// notes
//


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<int,int> pii;
typedef vector<int> vi;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define meme(x,y) memset(x, y, sizeof x)
#define pb push_back
#define mp make_pair

#ifdef _DEBUG
#define debug_text(...) printf(__VA_ARGS__)
#else
#define debug_text(...) /* --- NOTHING --- */
#endif

const int mod = 1e9+7;
const ll INF = ll(1e18);
const int inf = numeric_limits<int>::max();
const int N = 105;

int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

char graph[3][N];
int n, k, t;

struct P {
	int x, y, move;
	P(int _x, int _y, int _move) : x(_x), y(_y), move(_move) {}
};

bool valid(int x, int y) {
	if (x >= 0 && x < 3 && y >= 0 && y < n) return true;
	return false;
}

bool bfs (int a, int b) {
	queue<P> q;
	q.push(P(a,b,0));
	while (not q.empty()) {
		P u = q.front(); q.pop();
		if (u.y == n-1 && graph[u.x][u.y] == '.') return true;
		if (isupper(graph[u.x][u.y])) continue;
		if (u.move%4 == 1) {
			q.push(P(u.x,u.y,u.move+1));
			if (valid(u.x+1,u.y)) q.push(P(u.x+1,u.y,u.move+1));
			if (valid(u.x-1,u.y)) q.push(P(u.x-1,u.y,u.move+1));
		} else {
			q.push(P(u.x, u.y+1, u.move+1));
		}
	}
	return false;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> t;

	while (t--) {
		cin >> n >> k;
		for (int i = 0; i < 3; i++) cin >> graph[i];
		for (int i = 0; i < 3; i++) {
			if (graph[i][0] == 's') cout << (bfs(i,0) ? "YES\n" : "NO\n");
		}

	}
    return 0;
}
// notes
//


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<int,int> pii;
typedef vector<int> vi;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define meme(x,y) memset(x, y, sizeof x)
#define pb push_back
#define mp make_pair

#ifdef _DEBUG
#define debug_text(...) printf(__VA_ARGS__)
#else
#define debug_text(...) /* --- NOTHING --- */
#endif

const int mod = 1e9+7;
const ll INF = ll(1e18);
const int inf = numeric_limits<int>::max();
const int N = 105;

int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

char graph[3][N];
bool vis[3][N];
int n, k, t;

struct P {
	int x, y;
	P(int _x, int _y) : x(_x), y(_y) {}
};

bool valid(int x, int y) {
	if (x >= 0 && x < 3 && y >= 0 && y < n) return true;
	return false;
}

bool bfs (int a, int b) {
	queue<P> q;
	q.push(P(a,b));
	while (not q.empty()) {
		P u = q.front(); q.pop();
		if (isalpha(graph[u.x][++u.y])) continue; // mandatory move right
		if (u.y >= n-1) return true;
		for (int i = -1; i <= 1; i++) {
			int tx = u.x+i;
			if (!valid(tx,u.y)) continue;
			if (isalpha(graph[tx][u.y]) ||
				isalpha(graph[tx][u.y+1]) ||
				isalpha(graph[tx][u.y+2]) ||
				vis[tx][u.y+2]) continue;
			if (u.y+2 >= n-1) return true;
			vis[tx][u.y+2] = 1;
			q.push(P(tx,u.y+2));
		}
	}
	return false;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> t;
	while (t--) {
		meme(vis,0);
		cin >> n >> k;
		for (int i = 0; i < 3; i++)
			for (int j = 0; j < n; j++) cin >> graph[i][j];

		for (int i = 0; i < 3; i++) {
			if (graph[i][0] == 's') {
				cout << (bfs(i,0) ? "YES\n" : "NO\n");
				break;
			}
		}

	}
    return 0;
}
// notes
//


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<int,int> pii;
typedef vector<int> vi;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define meme(x,y) memset(x, y, sizeof x)
#define pb push_back
#define mp make_pair

#ifdef _DEBUG
#define debug_text(...) printf(__VA_ARGS__)
#else
#define debug_text(...) /* --- NOTHING --- */
#endif

const int mod = 1e9+7;
const ll INF = ll(1e18);
const int inf = numeric_limits<int>::max();
const int N = 105;

int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

char graph[3][N];
bool vis[3][N];
int n, k, t;

struct P {
	int x, y;
	P(int _x, int _y) : x(_x), y(_y) {}
};

bool valid(int x, int y) {
	if (x >= 0 && x < 3 && y >= 0 && y < n) return true;
	return false;
}

bool bfs (int a, int b) {
	queue<P> q;
	q.push(P(a,b));
	while (not q.empty()) {
		P u = q.front(); q.pop();
		if (isalpha(graph[u.x][++u.y])) continue; // mandatory move right
		if (u.y >= n-1) return true;
		for (int i = -1; i <= 1; i++) {
			int tx = u.x+i;
			if (tx < 0 || tx > 2) continue;
			if (isalpha(graph[tx][u.y]) ||
				isalpha(graph[tx][u.y+1]) ||
				isalpha(graph[tx][u.y+2]) ||
				vis[tx][u.y+2]) continue;
			if (u.y+2 >= n-1) return true;
			vis[tx][u.y+2] = 1;
			q.push(P(tx,u.y+2));
		}
	}
	return false;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> t;
	while (t--) {
		meme(vis,0);
		cin >> n >> k;
		for (int i = 0; i < 3; i++) cin >> graph[i];

		for (int i = 0; i < 3; i++) {
			if (graph[i][0] == 's') {
				cout << (bfs(i,0) ? "YES\n" : "NO\n");
				break;
			}
		}

	}
    return 0;
}
// notes
//


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<int,int> pii;
typedef vector<int> vi;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define meme(x,y) memset(x, y, sizeof x)
#define pb push_back
#define mp make_pair

#ifdef _DEBUG
#define debug_text(...) printf(__VA_ARGS__)
#else
#define debug_text(...) /* --- NOTHING --- */
#endif

const int mod = 1e9+7;
const ll INF = ll(1e18);
const int inf = numeric_limits<int>::max();
const int N = 105;

int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

char graph[3][N];
bool vis[3][N];
int n, k, t;

struct P {
	int x, y;
	P(int _x, int _y) : x(_x), y(_y) {}
};

bool valid(int x, int y) {
	if (x >= 0 && x < 3 && y >= 0 && y < n) return true;
	return false;
}

bool bfs (int a, int b) {
	queue<P> q;
	q.push(P(a,b));
	while (not q.empty()) {
		P u = q.front(); q.pop();
		if (isalpha(graph[u.x][++u.y])) continue; // mandatory move right
		if (u.y >= n-1) return true;
		for (int i = -1; i <= 1; i++) {
			int tx = u.x+i;
			if (!valid(tx,u.y)) continue;
			if (isalpha(graph[tx][u.y]) ||
				isalpha(graph[tx][u.y+1]) ||
				isalpha(graph[tx][u.y+2]) ||
				graph[tx][u.y+2] == '$') continue;
			if (u.y+2 >= n-1) return true;
			graph[tx][u.y+2] = '$';
			q.push(P(tx,u.y+2));
		}
	}
	return false;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> t;
	while (t--) {
		meme(vis,0);
		cin >> n >> k;
		for (int i = 0; i < 3; i++)
			for (int j = 0; j < n; j++) cin >> graph[i][j];

		for (int i = 0; i < 3; i++) {
			if (graph[i][0] == 's') {
				cout << (bfs(i,0) ? "YES\n" : "NO\n");
				break;
			}
		}

	}
    return 0;
}
// notes
//


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<int,int> pii;
typedef vector<int> vi;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define meme(x,y) memset(x, y, sizeof x)
#define pb push_back
#define mp make_pair

#ifdef _DEBUG
#define debug_text(...) printf(__VA_ARGS__)
#else
#define debug_text(...) /* --- NOTHING --- */
#endif

const int mod = 1e9+7;
const ll INF = ll(1e18);
const int inf = numeric_limits<int>::max();
const int N = 105;

int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

char graph[3][N];
int n, k, t;

struct P {
	int x, y, move;
	P(int _x, int _y, int _move) : x(_x), y(_y), move(_move) {}
};

bool valid(int x, int y) {
	if (x >= 0 && x < 3 && y >= 0 && y < n) return true;
	return false;
}

bool dfs (int a, int b) {
	stack<P> q;
	q.push(P(a,b,0));
	while (not q.empty()) {
		P u = q.top(); q.pop();
		if (u.y == n-1 && graph[u.x][u.y] == '.') return true;
		if (isupper(graph[u.x][u.y])) continue;
		if (u.move%4 == 1) {
			q.push(P(u.x,u.y,u.move+1));
			if (valid(u.x+1,u.y)) q.push(P(u.x+1,u.y,u.move+1));
			if (valid(u.x-1,u.y)) q.push(P(u.x-1,u.y,u.move+1));
		} else {
			q.push(P(u.x, u.y+1, u.move+1));
		}
	}
	return false;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> t;

	while (t--) {
		cin >> n >> k;
		for (int i = 0; i < 3; i++) cin >> graph[i];
		for (int i = 0; i < 3; i++) {
			if (graph[i][0] == 's') cout << (dfs(i,0) ? "YES\n" : "NO\n");
		}

	}
    return 0;
}
// notes
//


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<int,int> pii;
typedef vector<int> vi;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define meme(x,y) memset(x, y, sizeof x)
#define pb push_back
#define mp make_pair

#ifdef _DEBUG
#define debug_text(...) printf(__VA_ARGS__)
#else
#define debug_text(...) /* --- NOTHING --- */
#endif

const int mod = 1e9+7;
const ll INF = ll(1e18);
const int inf = numeric_limits<int>::max();
const int N = 105;

int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

char graph[3][N];
bool vis[3][N];
int n, k, t;

struct P {
	int x, y;
	P(int _x, int _y) : x(_x), y(_y) {}
};

bool valid(int x, int y) {
	if (x >= 0 && x < 3 && y >= 0 && y < n) return true;
	return false;
}

bool bfs (int a, int b) {
	queue<P> q;
	q.push(P(a,b));
	while (not q.empty()) {
		P u = q.front(); q.pop();
		if (isalpha(graph[u.x][++u.y])) continue; // mandatory move right
		if (u.y >= n-1) return true;
		for (int i = -1; i <= 1; i++) {
			int tx = u.x+i;
			if (tx < 0 || tx > 2) continue;
			if (isalpha(graph[tx][u.y]) ||
				isalpha(graph[tx][u.y+1]) ||
				isalpha(graph[tx][u.y+2]) ||
				graph[tx][u.y+2] == '$') continue;
			if (u.y+2 >= n-1) return true;
			graph[tx][u.y+2] = '$';
			q.push(P(tx,u.y+2));
		}
	}
	return false;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> t;
	while (t--) {
		meme(vis,0);
		cin >> n >> k;
		for (int i = 0; i < 3; i++) cin >> graph[i];

		for (int i = 0; i < 3; i++) {
			if (graph[i][0] == 's') {
				cout << (bfs(i,0) ? "YES\n" : "NO\n");
				break;
			}
		}

	}
    return 0;
}
// notes
//


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=(int)(2e9);
const ll INF=(ll)(5e18);
const int N=100010;
int dx[]={0,1,-1};
int m,n=3,k,vis[4][201],T;
char s[4][201];

bool dfs(int x,int y)
{
	int ret=0;
	if(y>=m) return 1;
	for(int i=0;i<3;i++)
	{
		int xx=x;
		int yy=y+1;
		if(s[xx][yy]!='.') continue;
		if(yy==m) return 1;
		xx=x+dx[i];
		if(xx<1||xx>n||s[xx][yy]!='.') continue;
		if(yy==m-1&&s[xx][yy+1]=='.') return 1;
		if(s[xx][yy+1]!='.'||s[xx][yy+2]!='.'||vis[xx][yy+2]) continue;
		vis[xx][yy+2]=1;
		ret|=dfs(xx,yy+2);
	}
	return ret;
}

int main()
{
	cin>>T;
	while(T--)
	{
		memset(vis,0,sizeof(vis));
		int sx,sy;
		scanf("%d%d",&m,&k); getchar();
		for(int i=1;i<=n;i++)
		{
			scanf("%s",s[i]+1);
			for(int j=1;j<=m;j++)
			{
				if(s[i][j]=='s') sx=i,sy=j;
			}
		}
		vis[sx][sy]=1;
		if(dfs(sx,sy)) puts("YES");
		else puts("NO");
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=(int)(2e9);
const ll INF=(ll)(5e18);
const int N=100010;
int dx[]={0,1,-1};
int m,n=3,k,vis[4][201];
char s[4][201];

bool dfs(int x,int y)
{
	int ret=0;
	if(y>=m) return 1;
	for(int i=0;i<3;i++)
	{
		int xx=x;
		int yy=y+1;
		if(s[xx][yy]!='.') continue;
		xx=x+dx[i];
		if(xx<1||yy<1||xx>n||s[xx][yy]!='.') continue;
		if(yy==m||(y==m-1&&s[xx][yy+1]=='.')) return 1;
		if(s[xx][yy+1]!='.'||s[xx][yy+2]!='.') continue;
		ret|=dfs(xx,yy+2);
	}
	return ret;
}

int main()
{
	int T;
	cin>>T;
	while(T--)
	{
		memset(vis,0,sizeof(vis));
		int sx,sy;
		scanf("%d%d",&m,&k); getchar();
		for(int i=1;i<=n;i++)
		{
			scanf("%s",s[i]+1);
			for(int j=1;j<=m;j++)
			{
				if(s[i][j]=='s') sx=i,sy=j;
			}
		}
		vis[sx][sy]=1;
		if(dfs(sx,sy)) puts("YES");
		else puts("NO");
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=(int)(2e9);
const ll INF=(ll)(5e18);
const int N=100010;
int dx[]={0,1,-1};
int m,n=3,k,vis[4][201];
char s[4][201];

bool dfs(int x,int y)
{
	int ret=0;
	if(y>=m) return 1;
	for(int i=0;i<3;i++)
	{
		int xx=x;
		int yy=y+1;
		if(s[xx][yy]!='.') continue;
		if(yy==m) return 1;
		xx=x+dx[i];
		if(xx<1||xx>n||s[xx][yy]!='.') continue;
		if(y==m-1&&s[xx][yy+1]=='.') return 1;
		if(s[xx][yy+1]!='.'||s[xx][yy+2]!='.'||vis[xx][yy+2]) continue;
		vis[xx][yy+2]=1;
		ret|=dfs(xx,yy+2);
	}
	return ret;
}

int main()
{
	int T;
	cin>>T;
	while(T--)
	{
		memset(vis,0,sizeof(vis));
		int sx,sy;
		scanf("%d%d",&m,&k); getchar();
		for(int i=1;i<=n;i++)
		{
			scanf("%s",s[i]+1);
			for(int j=1;j<=m;j++)
			{
				if(s[i][j]=='s') sx=i,sy=j;
			}
		}
		vis[sx][sy]=1;
		if(dfs(sx,sy)) puts("YES");
		else puts("NO");
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf=(int)(2e9);
const ll INF=(ll)(5e18);
const int N=100010;
int dx[]={0,1,-1};
int m,n=3,k,vis[4][201];
char s[4][201];

bool dfs(int x,int y)
{
	int ret=0;
	if(y>=m) return 1;
	for(int i=0;i<3;i++)
	{
		int xx=x;
		int yy=y+1;
		if(s[xx][yy]!='.') continue;
		xx=x+dx[i];
		if(xx<1||yy<1||xx>n||s[xx][yy]!='.') continue;
		if(yy==m||(y==m-1&&s[xx][yy+1]=='.')) return 1;
		if(s[xx][yy+1]!='.'||s[xx][yy+2]!='.'||vis[xx][yy+2]) continue;
		vis[xx][yy+2]=1;
		ret|=dfs(xx,yy+2);
	}
	return ret;
}

int main()
{
	int T;
	cin>>T;
	while(T--)
	{
		memset(vis,0,sizeof(vis));
		int sx,sy;
		scanf("%d%d",&m,&k); getchar();
		for(int i=1;i<=n;i++)
		{
			scanf("%s",s[i]+1);
			for(int j=1;j<=m;j++)
			{
				if(s[i][j]=='s') sx=i,sy=j;
			}
		}
		vis[sx][sy]=1;
		if(dfs(sx,sy)) puts("YES");
		else puts("NO");
	}
	return 0;
}


#include <bits/stdc++.h>

#define f first
#define s second

#define pb push_back
#define mp make_pair

#define pii pair<int, int>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int INF = (int) 1e9 + 7;
const int MAXN = (int) 1e6 + 10;

int cases;
int n, k;

string s[4];

bool now[4][101];
bool after[4][101];

bool dp[4][101];

int main() {
  cin >> cases;
  while (cases--) {
    cin >> n >> k;
    memset(dp, 0, sizeof dp);
    vector<pii> trains;
    for (int i = 0; i < 3; i++) {
      cin >> s[i];
      for (int j = 0; j < s[i].size(); j++) {
        if (isupper(s[i][j]))
          trains.pb(mp(i, j));
      }
    }
    if (s[0][0] == 's') dp[0][0] = 1;
    else if (s[1][0] == 's') dp[1][0] = 1;
    else dp[2][0] = 1;

    for (int T = 0; T + 1 < n; T++) {
      for (int row = 0; row < 3; row++) {
        if (!dp[row][T]) continue;
        //cout<<T<<' '<<row<<endl;
        for (int i = 0; i < 3; i++)
          for (int j = 0; j < n; j++)
            now[i][j] = after[i][j] = false;
        for (auto it : trains) {
          //cout<<"ban "<<it.f<<' '<<it.s<<endl;
          //cout<<"ban "<<it.f<<' '<<it.s-2<<endl;
          if (it.s >= 0)
            now[it.f][it.s] = true;

          if (it.s - 2 >= 0) {
            after[it.f][it.s - 2] = true;
          }
          if (it.s - 1 >= 0) {
            after[it.f][it.s - 1] = true;
          }
        }
        for (int go = 0; go < 3; go++)
          if (!now[go][T + 1] && !now[row][T + 1] && !after[go][T + 1])
            dp[go][T + 1] |= dp[row][T];
      }
      for (auto &it : trains)
        it.s -= 2;
    }
    bool ok = 0;
    for (int i = 0; i < 3; i++)
      ok |= dp[i][n - 1];
    if (ok) cout << "YES\n";
    else cout << "NO\n";
  }
}


#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <queue>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;

#define REP(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, j, k) for(int i = (j); i <= (k); ++i)
#define pii pair<int, int>
#define fr first
#define sc second
#define inf 1e9
#define ull unsigned long long
#define ll long long
#define lowbit(x) ((x)&(-x))

int test;
int n, k;
char str[3][111];
bool dp[3][111];

bool ok(int a, int b) {
	char x = str[a][b];
	if (x >= 'A' && x <= 'Z') return 0;
	return 1;
}

void mv(int row, int col, int d) {
	if (row + d < 0 || row + d >= 3) return ;
  ++col;
  if (!ok(row, col)) return ;
  row += d;
  if (!ok(row, col)) return ;
  ++col;
  if (!ok(row, col)) return ;
  ++col;
  if (!ok(row, col)) return ;
  dp[row][col] = 1;
}

int main() {
//	freopen("data", "r", stdin);

	cin >> test;
	while (test--) {
		memset(str, 0, sizeof(str));
		memset(dp, 0, sizeof(dp));
		cin >> n >> k;
		REP(i, 3) cin >> str[i];
		REP(i, 3) if (str[i][0] == 's') dp[i][0] = 1;
		REP(col, n) REP(row, 3) if (dp[row][col]) {
			FOR(t, -1, 1) mv(row, col, t);
		}

		bool flag = 0;
		FOR(col, n - 1, n + 3) REP(row, 3)
			if (dp[row][col]) flag = 1;
		if (flag) puts("YES");
		else puts("NO");
	}
}


#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
const int MaxN=110;
int N,K;
char map1[5][MaxN];
bool vis[5][MaxN];
int que[1000000];
int first,last;
void bfs()
{
    first=last=0;
    int p;
    int x,y;
    int u;
    for(int i=1;i<=3;++i) if(map1[i][1]=='s') p=i;
    que[last++]=p*1000+1;
    vis[p][1]=1;
    while(last-first)
    {
        u=que[first++];
        x=u/1000;
        y=u-x*1000;
        if(y<N && vis[x][y+1]==0 && map1[x][y+1]=='.')
        {
            vis[x][y+1]=1;
            que[last++]=x*1000+y+1;
        }
        if(y%3==2 && x>1 && vis[x-1][y]==0 && map1[x-1][y]=='.')
        {
            vis[x-1][y]=1;
            que[last++]=(x-1)*1000+y;
        }
        if(y%3==2 && x<3 && vis[x+1][y]==0 && map1[x+1][y]=='.')
        {
            vis[x+1][y]=1;
            que[last++]=(x+1)*1000+y;
        }
    }
}
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d %d",&N,&K);
        for(int i=1;i<=3;++i)
            scanf("%s",map1[i]+1);
        memset(vis,0,sizeof(vis));

        bfs();

        if(vis[1][N] || vis[2][N] || vis[3][N])
            puts("YES");
        else puts("NO");
    }
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
const int N = 2e5 + 10;
const ll inf = 1e15 + 42;
#define endl "\n"
set <pair<int, int>> winning;
char grid[4][104];
int xo, yo;
int ans;
int vis[3][103];
int n, k;
int dx[] = {1, 0, -1};
int dy[] = {1, 1, 1};

class point {
    public :
    int x, y, move;
};

point create (int xx, int yy, int mo) {
    point p1;
    p1.x = xx;
    p1.y = yy;
    p1.move = mo;
    return p1;
}

int isBoun (int xx, int yy) {
    if (xx < 1 || xx > 3 || yy < 1 || yy > n)
        return 0;
    else
        return 1;
}

int isRange (int xx, int yy) {
    if (!isBoun(xx, yy) || vis[xx][yy]==1)
        return 0;
    if (isBoun(xx, yy+1) && grid[xx][yy+1] >= 'A' && grid[xx][yy+1] <= 'Z') {
        return 0;
    }
    if (isBoun(xx, yy+2) && grid[xx][yy+2] >= 'A' && grid[xx][yy+2] <= 'Z')
        return 0;
    if (grid[xx][yy] >= 'A' && grid[xx][yy] <= 'Z')
        return 0;
    return 1;
}

void update () {
    for (int i=1; i<=3; i++) {
        for (int j=1; j<=n; j++) {
            //cout << "SEE:" << grid[i][j] << endl;
            if (grid[i][j] >= 'A' && grid[i][j] <= 'Z') {
                //train strats
                //move train two steps backward
                int end;
                for (int k=j+1; ; k++) {
                    if (k>n || grid[i][k] != grid[i][j]) {
                        //train end before
                        if (isBoun(i, k-1))
                            grid[i][k-1] = '.';
                        if (isBoun(i, k-2))
                            grid[i][k-2] = '.';
                        end = k;
                        break;
                    }
                }
                if (isBoun(i, j-1))
                    grid[i][j-1] = grid[i][j];
                if (isBoun(i, j-2))
                    grid[i][j-2] = grid[i][j];

                j = end-1;
            }
        }
    }
}

void bfs () {
    int lvl = 0;
    queue <point> q;
    q.push (create(xo, yo, 0));
    grid[xo][yo] = '.';
    vis[xo][yo] = 1;
    while (!q.empty()) {
        point p1 = q.front();
       // cout << "POINT: " << p1.x << " " << p1.y << " " << p1.move << endl;
        q.pop();
        if (winning.find(make_pair(p1.x , p1.y)) != winning.end()) {
            ans = 1;
            return;
        }
        if (p1.move == lvl+1) {
            update();
          //  cout << "DONE: " << endl;
            lvl++;
        }
        for (int i=0; i<3 && grid[p1.x][p1.y+1] == '.'; i++) {
            int x = p1.x + dx[i];
            int y = p1.y + dy[i];
            if (isRange (x, y)) {
                vis[x][y] = 1;
                q.push (create(x, y, p1.move+1));
            }
        }
    }
    return;
}

void testCase() {
    int t;
    cin >> t;
    while (t--) {
        //int n, k;
        cin >> n >> k;
        ans = 0;
        winning.clear();
        winning.insert (make_pair(1, n));
        winning.insert (make_pair(2, n));
        winning.insert (make_pair(3, n));
        for (int i=1; i<=3; i++) {
            string s;
            cin >> s;
            for (int j=0; j<s.size(); j++) {
                vis[i][j+1] = 0;
                grid[i][j+1] = s[j];
                if (s[j] == 's') {
                    xo = i;
                    yo = j+1;
                }
            }
        }
        // for (int i=1; i<=3; i++) {
        //     for (int j=1; j<=n; j++)
        //         cout << grid[i][j];
        //     cout << endl;
        // }
        bfs ();
        ans == 1 ? (cout << "YES" << endl) : (cout << "NO" << endl);
    }
}

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    testCase();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
const int N = 2e5 + 10;
const ll inf = 1e15 + 42;
#define endl "\n"
set <pair<int, int>> winning;
char grid[4][104];
int xo, yo;
int ans;
int vis[4][104];
int n, k;
int dx[] = {1, 0, -1};
int dy[] = {1, 1, 1};

class point {
    public :
    int x, y, move;
};

point create (int xx, int yy, int mo) {
    point p1;
    p1.x = xx;
    p1.y = yy;
    p1.move = mo;
    return p1;
}

int isBoun (int xx, int yy) {
    if (xx < 1 || xx > 3 || yy < 1 || yy > n)
        return 0;
    else
        return 1;
}

int isRange (int xx, int yy) {
    if (!isBoun(xx, yy) || vis[xx][yy]==1)
        return 0;
    if (isBoun(xx, yy+1) && grid[xx][yy+1] >= 'A' && grid[xx][yy+1] <= 'Z') {
        return 0;
    }
    if (isBoun(xx, yy+2) && grid[xx][yy+2] >= 'A' && grid[xx][yy+2] <= 'Z')
        return 0;
    if (grid[xx][yy] >= 'A' && grid[xx][yy] <= 'Z')
        return 0;
    return 1;
}

void update () {
    for (int i=1; i<=3; i++) {
        for (int j=1; j<=n; j++) {
            //cout << "SEE:" << grid[i][j] << endl;
            if (grid[i][j] >= 'A' && grid[i][j] <= 'Z') {
                //train strats
                //move train two steps backward
                int end;
                char ch = grid[i][j];
                for (int k=j+1; ; k++) {
                    if (k>n || grid[i][k] != ch) {
                        //train end before
                        if (isBoun(i, k-1))
                            grid[i][k-1] = '.';
                        if (isBoun(i, k-2))
                            grid[i][k-2] = '.';
                        end = k;
                        break;
                    }
                }
                if (isBoun(i, j-1))
                    grid[i][j-1] = ch;
                if (isBoun(i, j-2))
                    grid[i][j-2] = ch;

                j = end-1;
            }
        }
    }
}

void bfs () {
    int lvl = 0;
    queue <point> q;
    q.push (create(xo, yo, 0));
    grid[xo][yo] = '.';
    vis[xo][yo] = 1;
    while (!q.empty()) {
        point p1 = q.front();
       // cout << "POINT: " << p1.x << " " << p1.y << " " << p1.move << endl;
        q.pop();
        if (winning.find(make_pair(p1.x , p1.y)) != winning.end()) {
            ans = 1;
            return;
        }
        if (p1.move == lvl+1) {
            update();
          //  cout << "DONE: " << endl;
            lvl++;
        }
        for (int i=0; i<3 && grid[p1.x][p1.y+1] == '.'; i++) {
            int x = p1.x + dx[i];
            int y = p1.y + dy[i];
            if (isRange (x, y)) {
                vis[x][y] = 1;
                q.push (create(x, y, p1.move+1));
            }
        }
    }
    return;
}

void testCase() {
    int t;
    cin >> t;
    while (t--) {
        //int n, k;
        cin >> n >> k;
        ans = 0;
        winning.clear();
        winning.insert (make_pair(1, n));
        winning.insert (make_pair(2, n));
        winning.insert (make_pair(3, n));
        for (int i=0; i<=3; i++) {
            for (int j=0; j<=100; j++) {
                grid[i][j] = '.';
                vis[i][j] = 0;
            }
        }
        for (int i=1; i<=3; i++) {
            string s;
            cin >> s;
            for (int j=0; j<s.size(); j++) {
                grid[i][j+1] = s[j];
                if (s[j] == 's') {
                    xo = i;
                    yo = j+1;
                }
            }
        }
        // for (int i=1; i<=3; i++) {
        //     for (int j=1; j<=n; j++)
        //         cout << grid[i][j];
        //     cout << endl;
        // }
        bfs ();
        ans == 1 ? (cout << "YES" << endl) : (cout << "NO" << endl);
    }
}

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    testCase();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
const int N = 2e5 + 10;
const ll inf = 1e15 + 42;
#define endl "\n"
set <pair<int, int>> winning;
char grid[4][104];
int xo, yo;
int ans;
int vis[4][104];
int n, k;
int dx[] = {1, 0, -1};
int dy[] = {1, 1, 1};

class point {
    public :
    int x, y, move;
};

point create (int xx, int yy, int mo) {
    point p1;
    p1.x = xx;
    p1.y = yy;
    p1.move = mo;
    return p1;
}

int isBoun (int xx, int yy) {
    if (xx < 1 || xx > 3 || yy < 1 || yy > n)
        return 0;
    else
        return 1;
}

int isRange (int xx, int yy) {
    if (!isBoun(xx, yy) || vis[xx][yy]==1)
        return 0;
    if (isBoun(xx, yy+1) && grid[xx][yy+1] >= 'A' && grid[xx][yy+1] <= 'Z') {
        return 0;
    }
    if (isBoun(xx, yy+2) && grid[xx][yy+2] >= 'A' && grid[xx][yy+2] <= 'Z')
        return 0;
    if (grid[xx][yy] >= 'A' && grid[xx][yy] <= 'Z')
        return 0;
    return 1;
}

void update () {
    for (int i=1; i<=3; i++) {
        for (int j=1; j<=n; j++) {
            //cout << "SEE:" << grid[i][j] << endl;
            if (grid[i][j] >= 'A' && grid[i][j] <= 'Z') {
                //train strats
                //move train two steps backward
                int end;
                for (int k=j+1; ; k++) {
                    if (k>n || grid[i][k] != grid[i][j]) {
                        //train end before
                        if (isBoun(i, k-1))
                            grid[i][k-1] = '.';
                        if (isBoun(i, k-2))
                            grid[i][k-2] = '.';
                        end = k;
                        break;
                    }
                }
                if (isBoun(i, j-1))
                    grid[i][j-1] = grid[i][j];
                if (isBoun(i, j-2))
                    grid[i][j-2] = grid[i][j];

                j = end-1;
            }
        }
    }
}

void bfs () {
    int lvl = 0;
    queue <point> q;
    q.push (create(xo, yo, 0));
    grid[xo][yo] = '.';
    vis[xo][yo] = 1;
    while (!q.empty()) {
        point p1 = q.front();
       // cout << "POINT: " << p1.x << " " << p1.y << " " << p1.move << endl;
        q.pop();
        if (winning.find(make_pair(p1.x , p1.y)) != winning.end()) {
            ans = 1;
            return;
        }
        if (p1.move == lvl+1) {
            update();
          //  cout << "DONE: " << endl;
            lvl++;
        }
        for (int i=0; i<3 && grid[p1.x][p1.y+1] == '.'; i++) {
            int x = p1.x + dx[i];
            int y = p1.y + dy[i];
            if (isRange (x, y)) {
                vis[x][y] = 1;
                q.push (create(x, y, p1.move+1));
            }
        }
    }
    return;
}

void testCase() {
    int t;
    cin >> t;
    while (t--) {
        //int n, k;
        cin >> n >> k;
        ans = 0;
        winning.clear();
        winning.insert (make_pair(1, n));
        winning.insert (make_pair(2, n));
        winning.insert (make_pair(3, n));
        for (int i=1; i<=3; i++) {
            string s;
            cin >> s;
            for (int j=0; j<s.size(); j++) {
                vis[i][j+1] = 0;
                grid[i][j+1] = s[j];
                if (s[j] == 's') {
                    xo = i;
                    yo = j+1;
                }
            }
        }
        // for (int i=1; i<=3; i++) {
        //     for (int j=1; j<=n; j++)
        //         cout << grid[i][j];
        //     cout << endl;
        // }
        bfs ();
        ans == 1 ? (cout << "YES" << endl) : (cout << "NO" << endl);
    }
}

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    testCase();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
const int N = 2e5 + 10;
const ll inf = 1e15 + 42;
#define endl "\n"
set <pair<int, int>> winning;
char grid[4][104];
int xo, yo;
int ans;
int vis[4][104];
int n, k;
int dx[] = {1, 0, -1};
int dy[] = {1, 1, 1};

class point {
    public :
    int x, y, move;
};

point create (int xx, int yy, int mo) {
    point p1;
    p1.x = xx;
    p1.y = yy;
    p1.move = mo;
    return p1;
}

int isBoun (int xx, int yy) {
    if (xx < 1 || xx > 3 || yy < 1 || yy > n)
        return 0;
    else
        return 1;
}

int isRange (int xx, int yy) {
    if (!isBoun(xx, yy) || vis[xx][yy]==1)
        return 0;
    if (isBoun(xx, yy+1) && grid[xx][yy+1] >= 'A' && grid[xx][yy+1] <= 'Z') {
        return 0;
    }
    if (isBoun(xx, yy+2) && grid[xx][yy+2] >= 'A' && grid[xx][yy+2] <= 'Z')
        return 0;
    if (grid[xx][yy] >= 'A' && grid[xx][yy] <= 'Z')
        return 0;
    return 1;
}

void update () {
    for (int i=1; i<=3; i++) {
        for (int j=1; j<=n; j++) {
            //cout << "SEE:" << grid[i][j] << endl;
            if (grid[i][j] >= 'A' && grid[i][j] <= 'Z') {
                //train strats
                //move train two steps backward
                int end;
                for (int k=j+1; ; k++) {
                    if (k>n || grid[i][k] != grid[i][j]) {
                        //train end before
                        if (isBoun(i, k-1))
                            grid[i][k-1] = '.';
                        if (isBoun(i, k-2))
                            grid[i][k-2] = '.';
                        end = k;
                        break;
                    }
                }
                if (isBoun(i, j-1))
                    grid[i][j-1] = grid[i][j];
                if (isBoun(i, j-2))
                    grid[i][j-2] = grid[i][j];

                j = end-1;
            }
        }
    }
}

void bfs () {
    int lvl = 0;
    queue <point> q;
    q.push (create(xo, yo, 0));
    grid[xo][yo] = '.';
    vis[xo][yo] = 1;
    while (!q.empty()) {
        point p1 = q.front();
       // cout << "POINT: " << p1.x << " " << p1.y << " " << p1.move << endl;
        q.pop();
        if (winning.find(make_pair(p1.x , p1.y)) != winning.end()) {
            ans = 1;
            return;
        }
        if (p1.move == lvl+1) {
            update();
          //  cout << "DONE: " << endl;
            lvl++;
        }
        for (int i=0; i<3 && grid[p1.x][p1.y+1] == '.'; i++) {
            int x = p1.x + dx[i];
            int y = p1.y + dy[i];
            if (isRange (x, y)) {
                vis[x][y] = 1;
                q.push (create(x, y, p1.move+1));
            }
        }
    }
    return;
}

void testCase() {
    int t;
    cin >> t;
    while (t--) {
        //int n, k;
        cin >> n >> k;
        ans = 0;
        winning.clear();
        winning.insert (make_pair(1, n));
        winning.insert (make_pair(2, n));
        winning.insert (make_pair(3, n));
        for (int i=0; i<=3; i++) {
            for (int j=0; j<=100; j++) {
                grid[i][j] = '.';
                vis[i][j] = 0;
            }
        }
        for (int i=1; i<=3; i++) {
            string s;
            cin >> s;
            for (int j=0; j<s.size(); j++) {
                grid[i][j+1] = s[j];
                if (s[j] == 's') {
                    xo = i;
                    yo = j+1;
                }
            }
        }
        // for (int i=1; i<=3; i++) {
        //     for (int j=1; j<=n; j++)
        //         cout << grid[i][j];
        //     cout << endl;
        // }
        bfs ();
        ans == 1 ? (cout << "YES" << endl) : (cout << "NO" << endl);
    }
}

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    testCase();
    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define  pb  push_back
#define  mp  make_pair
#define  F   first
#define  S   second
typedef long long int ll;
const int N = 1e3+6;
int dx[] = {+1,+0,-1};
string s[N];
int n,m,vis[5][N];

bool Ok( int x,int y )
{
    for(int i=0;i<=3;i++)
    {
        if( s[x][i+y]!='.' )return false;
    }
    return true;
}

bool dfs( int x,int y )
{
    if( vis[x][y]==-1 )return false;
    if( y>=n )return true;
    for(int i=0;i<3;i++)
    {
        int now = x+dx[i];
        if( now>=0&&now<3&&s[now][y]=='.' )
        {
            if( Ok(now,y)&&dfs(now,y+3) )return true;
        }
    }
    vis[x][y] = -1;
    return false;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int Q;cin>>Q;
    while( Q-- )
    {
    cin>>n>>m;
    memset( vis,0,sizeof vis );
    for(int i=0;i<3;i++)
    {
        cin>>s[i];
        for(int j=0;j<4;j++)
            s[i] += '.';
    }
    int x;
    for(int i=0;i<3;i++)
    {
        if( s[i][0]=='s' )x = i;
    }
    if( s[x][1]!='.' )cout<< "NO\n";
    else
    {
        if( dfs(x,1) )cout<< "YES\n";
        else cout<< "NO\n";
    }
    }

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define  pb  push_back
#define  mp  make_pair
#define  F   first
#define  S   second
typedef long long int ll;
const int N = 1e3+6;
int dx[] = {+1,+0,-1};
string s[N];
int n,m,vis[5][N];

bool Ok( int x,int y )
{
    for(int i=1;i<=3;i++)
    {
        if( s[x][i+y]!='.' )return false;
    }
    return true;
}

bool dfs( int x,int y )
{
    if( vis[x][y]==-1 )return false;
    if( y>=n )return true;
    for(int i=0;i<3;i++)
    {
        int now = x+dx[i];
        if( now>=0&&now<3&&s[now][y]=='.' )
        {
            if( Ok(now,y)&&dfs(now,y+3) )return true;
        }
    }
    vis[x][y] = -1;
    return false;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int Q;cin>>Q;
    while( Q-- )
    {
    cin>>n>>m;
    memset( vis,0,sizeof vis );
    for(int i=0;i<3;i++)
    {
        cin>>s[i];
        for(int j=0;j<4;j++)
            s[i] += '.';
    }
    int x;
    for(int i=0;i<3;i++)
    {
        if( s[i][0]=='s' )x = i;
    }
    if( s[x][1]!='.' )cout<< "NO\n";
    else
    {
        if( dfs(x,1) )cout<< "YES\n";
        else cout<< "NO\n";
    }
    }

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define  pb  push_back
#define  mp  make_pair
#define  F   first
#define  S   second
typedef long long int ll;
const int N = 1e3+6;
int dx[] = {+1,+0,-1};
string s[N];
int n,m,vis[5][N];

bool Ok( int x,int y )
{
    for(int i=0;i<=3;i++)
    {
        if( s[x][i+y]!='.' )return false;
    }
    return true;
}

bool dfs( int x,int y )
{
    if( vis[x][y]==-1 )return false;
    if( y>=n )return true;
    for(int i=0;i<3;i++)
    {
        int now = x+dx[i];
        if( now>=0&&now<3&&s[now][y]=='.' )
        {
            if( Ok(now,y)&&dfs(now,y+3) )return true;
        }
    }
    vis[x][y] = -1;
    return false;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int Q;cin>>Q;
    while( Q-- )
    {
    cin>>n>>m;
    for(int i=0;i<3;i++)
    {
        cin>>s[i];
        for(int j=0;j<5;j++)
            s[i] += '.';
    }
    int x;
    for(int i=0;i<3;i++)
    {
        if( s[i][0]=='s' )x = i;
    }
    if( s[x][1]!='.' )cout<< "NO\n";
    else
    {
        if( dfs(x,1) )cout<< "YES\n";
        else cout<< "NO\n";
    }
    }

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define  pb  push_back
#define  mp  make_pair
#define  F   first
#define  S   second
typedef long long int ll;
const int N = 1e3+6;
int dx[] = {+1,+0,-1};
string s[N];
int n,m,vis[5][N];

bool Ok( int x,int y )
{
    for(int i=0;i<=3;i++)
    {
        if( s[x][i+y]!='.' )return false;
    }
    return true;
}

bool dfs( int x,int y )
{
    if( vis[x][y]==-1 )return false;
    if( y>=n )return true;
    for(int i=0;i<3;i++)
    {
        int now = x+dx[i];
        if( now>=0&&now<3&&s[now][y]=='.' )
        {
            if( Ok(now,y)&&dfs(now,y+3) )return true;
        }
    }
    vis[x][y] = -1;
    return false;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int Q;cin>>Q;
    while( Q-- )
    {
    cin>>n>>m;
    memset( vis,0,sizeof vis );
    for(int i=0;i<3;i++)
    {
        cin>>s[i];
        for(int j=0;j<4;j++)
            s[i] += '.';
    }
    int x;
    for(int i=0;i<3;i++)
    {
        if( s[i][0]=='s' )x = i;
    }
    if( s[x][1]!='.' )cout<< "NO\n";
    else
    {
        if( dfs(x,0) )cout<< "YES\n";
        else cout<< "NO\n";
    }
    }

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define  pb  push_back
#define  mp  make_pair
#define  F   first
#define  S   second
typedef long long int ll;
const int N = 1e3+6;
int dx[] = {+1,+0,-1};
string s[N];
int n,m,vis[5][N];

bool Ok( int x,int y )
{
    for(int i=0;i<=3;i++)
    {
        if( s[x][i+y]!='.' )return false;
    }
    return true;
}

bool dfs( int x,int y )
{
    if( vis[x][y]==-1 )return false;
    if( y>=n )return true;
    for(int i=0;i<3;i++)
    {
        int now = x+dx[i];
        if( now>=0&&now<3&&s[now][y]=='.' )
        {
            if( Ok(now,y)&&dfs(now,y+3) )return true;
        }
    }
    vis[x][y] = -1;
    return false;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int Q;cin>>Q;
    while( Q-- )
    {
    cin>>n>>m;
    for(int i=0;i<3;i++)
    {
        cin>>s[i];
        for(int j=0;j<4;j++)
            s[i] += '.';
    }
    int x;
    for(int i=0;i<3;i++)
    {
        if( s[i][0]=='s' )x = i;
    }
    if( s[x][1]!='.' )cout<< "NO\n";
    else
    {
        if( dfs(x,1) )cout<< "YES\n";
        else cout<< "NO\n";
    }
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define sz(a) (int)a.size()
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y)
{
    if (y < x)
        x = y;
}
template<typename T, typename U> static inline void amax(T &x, U y)
{
    if (x < y)
        x = y;
}

ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;}

const int N=110;
// vi s[Nl]
vector<string> s(5);
 int vis[N][5][5];
 int n;
 bool dfs(int x,int y,int cur){
 	// trace(x,y,cur);
 	if(y<0||y>2) return false;
 	if(x>=n) return true;

 	if(vis[x][y][cur]) return false;
 	vis[x][y][cur]=1;
 	if(s[y][x]!='.' && s[y][x]!='s') return false;
 	if(cur==0){
 		// trace(x,y,cur);
 		if(dfs(x+1,y,1)) return true;
 	}
 	else if(cur==1){
 		// trace(x,y,cur);
 		if(dfs(x,y-1,2)||dfs(x,y+1,2)||dfs(x,y,2)) return true;
 	}
 	else {
 		// trace(x,y,cur,s[y][x+1]);
 		if(s[y][x+1]=='.') if(dfs(x+2,y,0)) return true;;
 	}
 	return false;
 }
     int solve()
     {
     	int k;cin>>n>>k;
     	rep0(3) cin>>s[i];
     	rep0(3) s[i]+="..............";
     	memset(vis,0,sizeof(vis));
     	int x=0;
     	rep0(3) if(s[i][0]=='s') x=i;
     	if(dfs(0,x,0)) cout<<"YES";
     	else cout<<"NO";
     	cout<<endl;

        r0
     }
    signed main()
    {
        asdf

        int t=1;
        cin>>t;
        while(t--)
        {
            solve();
        }

}


#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define sz(a) (int)a.size()
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y)
{
    if (y < x)
        x = y;
}
template<typename T, typename U> static inline void amax(T &x, U y)
{
    if (x < y)
        x = y;
}

ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;}

int n;
    bool dfs(int pos,int cell,const vector<string> s){
        // trace(pos,cell);
        if(cell<0||cell>=3) return false;
        if(s[pos][cell]!='.' && s[pos][cell]!='s') return false;
        if(pos>=n-1){
            return true;
        }
        if(s[pos+1][cell]=='.'){
            if(s[pos+2][cell]=='.'){
                if(dfs(pos+3,cell,s)) return true;
            }
            if(cell<=1)
            if(s[pos+1][cell+1]=='.' && s[pos+2][cell+1]=='.') if(dfs(pos+3,cell+1,s)) return true;
            if(cell>=1)
            if(s[pos+1][cell-1]=='.' && s[pos+2][cell-1]=='.') if(dfs(pos+3,cell-1,s)) return true;
         }
        return false;

    }
     int solve()
     {
        int k;cin>>n>>k;
        // string s[5];
        // rep(1,4){
        //     cin>>s[i];
        // }
        // s[0]="";
        // rep0(n+1) s[0]+="A";
        vector<string> s(3);
        vector<string> t(n+10,"");

        inputarr(s,3);
        rep0(3) s[i]+="....";
         rep0(3){
            for(int j=0;j<n;j++){
                t[j]+=s[i][j];
            }
        }
        // rep0(n) cout<<t[i]<<endl;
        int c=0;
        rep0(3) if(s[i][0]=='s') c=i;
        if(dfs(0,c,t)) cout<<"YES";
        else cout<<"NO";cout<<endl;

        r0
     }
    signed main()
    {
        asdf

        int t=1;
        cin>>t;
        while(t--)
        {
            solve();
        }

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
char mp[5][200];
int v[5][120];
int dir1[4][2] = {{0,1},{0,2},{1,1},{-1,1}};
int n,k;
void dfs(int x,int y,int color){
	if(color == 1){
		if(v[x][y]) return ;
		v[x][y] =1;
		for(int i=0;i<4;i++){
			int nx = x + dir1[i][0];
			int ny = y + dir1[i][1];
			if(mp[x][y+1] != '.') continue;
			if(nx <1 || ny <1 || nx >3 || ny > n) continue;
			if(mp[nx][ny] == '.'){
//				cout << nx << "    " <<ny <<endl;
				dfs(nx,ny,3-color);
			}
		}
	}else{
		v[x][y]=1;
		int nx = x ;
		int ny = y + 2;
		if(nx <1 || ny <1 || nx >3 || ny > n) return;
		if(mp[nx][ny] == '.'){
			dfs(nx,ny,3-color);
		}
	}
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t;
	scanf("%d",&t);
	while(t--){
		scanf("%d%d",&n,&k);
		getchar();
		for(int i=1;i<=3;i++){
			for(int j=1;j<=n;j++){
				scanf("%c",&mp[i][j]);
			}
			getchar();
		}
//		for(int i=1;i<=3;i++){
//			for(int j=1;j<=n;j++){
//				printf("%c",mp[i][j]);
//			}
//			printf("\n");
//		}
		int sx,sy=1;
		for(int i=1;i<=3;i++)
		if(mp[i][1] == 's') sx=i;
		memset(v,0,sizeof(v));
		dfs(sx,sy,1);
		int c1=1,c2=0;
//		for(int i=1;i<=3;i++){
//			for(int j=1;j<=n;j++){
//				cout << v[i][j];
//			}
//			cout << endl;
//		}
		for(int i=1;i<=3;i++){
			for(int j=1;j<=n;j++){
				if(v[i][j]){
					c1 = max(c1,j);
				}
				if(mp[i][j] != '.'&&mp[i][j] !='s' ){
					c2 = max(c2,j);
				}
			}
		}
		if(c1 >= c2) cout << "YES" <<endl;
		else cout << "NO" <<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
char mp[5][120];
int v[5][120];
int dir1[4][2] = {{0,1},{0,2},{1,1},{-1,1}};
int n,k;
void dfs(int x,int y,int color){
	if(color == 1){
		v[x][y] =1;
		for(int i=0;i<4;i++){
			int nx = x + dir1[i][0];
			int ny = y + dir1[i][1];
			if(mp[x][y+1] != '.') continue;
			if(nx <1 || ny <1 || nx >3 || ny > n) continue;
			if(mp[nx][ny] == '.'){
				dfs(nx,ny,3-color);
			}
		}
	}else{
		v[x][y]=1;
		int nx = x ;
		int ny = y + 2;
		if(nx <1 || ny <1 || nx >3 || ny > n) return;
		if(mp[nx][ny] == '.'){
			dfs(nx,ny,3-color);
		}
	}
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t;
	scanf("%d",&t);
	while(t--){
		scanf("%d%d",&n,&k);
		getchar();
		for(int i=1;i<=3;i++){
			for(int j=1;j<=n;j++){
				scanf("%c",&mp[i][j]);
			}
			getchar();
		}
//		for(int i=1;i<=3;i++){
//			for(int j=1;j<=n;j++){
//				printf("%c",mp[i][j]);
//			}
//			printf("\n");
//		}
		int sx,sy=1;
		for(int i=1;i<=3;i++)
		if(mp[i][1] == 's') sx=i;
		memset(v,0,sizeof(v));
		dfs(sx,sy,1);
		int c1=1,c2=0;
//		for(int i=1;i<=3;i++){
//			for(int j=1;j<=n;j++){
//				cout << v[i][j];
//			}
//			cout << endl;
//		}
		for(int i=1;i<=3;i++){
			for(int j=1;j<=n;j++){
				if(v[i][j]){
					c1 = max(c1,j);
				}
				if(mp[i][j] != '.'&&mp[i][j] !='s' ){
					c2 = max(c2,j);
				}
			}
		}
		if(c1 >= c2) cout << "YES" <<endl;
		else cout << "NO" <<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
long long int t,m,d,w;
long long int gcd(long long int a,long long int b){
	if(b==0){
		return a;
	}
	else{
		return gcd(b,a%b);
	}
}
//void exgcd(int a,int b,int &dd,int &x,int &y){
//	if(!b){
//		dd=a;
//		x=1;y=0;
//	}
//	else{
//		exgcd(b,a%b,d,y,x);y-=x*(a/b);
//	}
//}
int main(){
	scanf("%lld",&t);
	while(t--){
		scanf("%lld%lld%lld",&m,&d,&w);
		long long int ovo=d-1;
		long long int gc=gcd(ovo,w);
		long long int g=w/gc;
		long long int maxn=min(d,m);
//		int dd,x,y;
		long long int ff=maxn/g;
		cout<<ff*maxn-g*(ff+1)*ff/2<<endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
long long int t,m,d,w;
long long int gcd(long long int a,long long int b){
	if(b==0){
		return a;
	}
	else{
		return gcd(b,a%b);
	}
}
//void exgcd(int a,int b,int &dd,int &x,int &y){
//	if(!b){
//		dd=a;
//		x=1;y=0;
//	}
//	else{
//		exgcd(b,a%b,d,y,x);y-=x*(a/b);
//	}
//}
int main(){
	scanf("%lld",&t);
	while(t--){
		scanf("%lld%lld%lld",&m,&d,&w);
		long long int ovo=d-1;
		long long int gc=gcd(ovo,w);
		long long int g=w/gc;
		long long int maxn=min(d,m);
//		int dd,x,y;
		long long int ff=maxn/g;
		cout<<ff*maxn-g*(ff+1)*ff/2)<<endl;
	}
}


#include <bits/stdc++.h>
#define pb push_back
#define rep(i, n) for (int i = 0; i < (int)n ; i++)
using namespace std;
typedef long long ll;
ll C2n(int n){
    return (ll)n * (n - 1) / 2;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t, m, d, w;
    ll ans;
    cin >> t;
    rep(i,t){
        cin >> m >> d >> w;
        if (d == 1){
            ans = C2n(m);
        }
        else{
            int gcd = __gcd(d - 1, w);
            int divide = w / gcd;
            ans = C2n(m / divide + 1) * (m % divide) + C2n(m / divide) * (divide - m % divide);
        }
        cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define rep(i, n) for (int i = 0; i < (int)n ; i++)
using namespace std;
typedef long long ll;
ll C2n(int n){
    return (ll)n * (n - 1) / 2;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t, m, d, w;
    ll ans;
    cin >> t;
    rep(i,t){
        cin >> m >> d >> w;
        if (d == 1){
            ans = C2n(m);
        }
        else{
            int gcd = __gcd(d - 1, w);
            int divide = w / gcd;
            m = min(m, d);
            ans = C2n(m / divide + 1) * (m % divide) + C2n(m / divide) * (divide - m % divide);
        }
        cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define rep(i, n) for (int i = 0; i < (int)n ; i++)
using namespace std;
typedef long long ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t, m, d, w;
    ll ans;
    cin >> t;
    rep(i,t){
        cin >> m >> d >> w;
        int _w = w / __gcd(d - 1, w);
        int mn = min(d, m); // as x, y is both month and day -> x, y <= min(d, m) (key!)
        int au = mn / _w;
        cout << ((ll)mn * au) - (ll)au * (au + 1) / 2 * _w << endl;
    }
    return 0;
}


#include <stdio.h>
#define LL long long
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int min(int a, int b) { return a < b ? a : b; }
int m, d, w, T, lim;
int main() {
	scanf("%d", &T);
	while (T--) {
		scanf("%d %d %d", &m, &d, &w);
		w /= gcd(w, d - 1), lim = min(m, d);
		printf("%lld\n", (LL)((lim << 1) - ((lim / w) * w) - w) * (lim / w) >> 1);
	}
	return 0;
}


#include <stdio.h>
#define LL long long
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int min(int a, int b) { return a < b ? a : b; }
int m, d, w, T, lim, num;
int main() {
	scanf("%d", &T);
	while (T--) {
		scanf("%d %d %d", &m, &d, &w);
		num = (lim = min(m, d)) / (w /= gcd(w, d - 1));
		printf("%lld\n", (LL)((lim << 1) - (num * w) - w) * num >> 1);
	}
	return 0;
}