/*
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                            O\ = /O
//                        ____/`---'\____
//                      .   ' \\| |// `.
//                       / \\||| : |||// \
//                     / _||||| -:- |||||- \
//                       | | \\\ - /// | |
//                     | \_| ''\---/'' | |
//                      \ .-\__ `-` ___/-. /
//                   ___`. .' /--.--\ `. . __
//                ."" '< `.___\_<|>_/___.' >'"".
//               | | : `- \`.;`\ _ /`;.`/ - ` : | |
//                 \ \ `-. \_ __\ /__ _/ .-` / /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//
//         .............................................
//                  佛祖镇楼                  BUG辟易
//          佛曰:
//                  写字楼里写字间，写字间里程序员；
//                  程序人员写程序，又拿程序换酒钱。
//                  酒醒只在网上坐，酒醉还来网下眠；
//                  酒醉酒醒日复日，网上网下年复年。
//                  但愿老死电脑间，不愿鞠躬老板前；
//                  奔驰宝马贵者趣，公交自行程序员。
//                  别人笑我忒疯癫，我笑自己命太贱；
//                  不见满街漂亮妹，哪个归得程序员？
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <fstream>
#define debug "output for debug\n"
#define pi (acos(-1.0))
#define eps (1e-8)
#define inf 0x3f3f3f3f
#define ll long long int
using namespace std;

int a,b,n;
int x;

int main(int argc, char const *argv[])
{
    scanf("%d%d%d", &a,&b,&n);
    if(a==0&&b==0)
    {
        printf("%d", 5);
    }
    else
    {
        if(a*b>0)
        {
            for(x=0; x<=1000; x++)
            {
                if(fabs(pow(1.0*x,1.0*n)-b*1.0/a)<eps)
                {
                    printf("%d\n", x);
                    return 0;
                }
            }
        }
        else if(a*b<0)
        {
            for(x=-1000; x<=0; x++)
            {
                if(fabs(pow(1.0*x,1.0*n)-b*1.0/a)<eps)
                {
                    printf("%d\n", x);
                    return 0;
                }
            }
        }
        else if(b==0)
        {
            printf("0\n");
            return 0;
        }
        printf("No solution\n");
    }
    return 0;
}


/*
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                            O\ = /O
//                        ____/`---'\____
//                      .   ' \\| |// `.
//                       / \\||| : |||// \
//                     / _||||| -:- |||||- \
//                       | | \\\ - /// | |
//                     | \_| ''\---/'' | |
//                      \ .-\__ `-` ___/-. /
//                   ___`. .' /--.--\ `. . __
//                ."" '< `.___\_<|>_/___.' >'"".
//               | | : `- \`.;`\ _ /`;.`/ - ` : | |
//                 \ \ `-. \_ __\ /__ _/ .-` / /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//
//         .............................................
//                  佛祖镇楼                  BUG辟易
//          佛曰:
//                  写字楼里写字间，写字间里程序员；
//                  程序人员写程序，又拿程序换酒钱。
//                  酒醒只在网上坐，酒醉还来网下眠；
//                  酒醉酒醒日复日，网上网下年复年。
//                  但愿老死电脑间，不愿鞠躬老板前；
//                  奔驰宝马贵者趣，公交自行程序员。
//                  别人笑我忒疯癫，我笑自己命太贱；
//                  不见满街漂亮妹，哪个归得程序员？
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <fstream>
#define debug "output for debug\n"
#define pi (acos(-1.0))
#define eps (1e-8)
#define inf 0x3f3f3f3f
#define ll long long int
using namespace std;

int a,b,n;
int x;

int main(int argc, char const *argv[])
{
    scanf("%d%d%d", &a,&b,&n);
    if(a==0&&b==0)
    {
        printf("%d", 5);
    }
    else
    {
        if(a*b>0)
        {
            for(x=0; x<=1000; x++)
            {
                if(fabs(pow(1.0*x,1.0*n)-b*1.0/a)<eps)
                {
                    printf("%d\n", x);
                    return 0;
                }
            }
        }
        else if(a==0)
        {
            for(x=-1000; x<=0; x++)
            {
                if(fabs(pow(1.0*x,1.0*n)-b*1.0/a)<eps)
                {
                    printf("%d\n", x);
                    return 0;
                }
            }
        }
        else if(b==0)
        {
            printf("0\n");
        }
        printf("No solution\n");
    }
    return 0;
}


/*
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                            O\ = /O
//                        ____/`---'\____
//                      .   ' \\| |// `.
//                       / \\||| : |||// \
//                     / _||||| -:- |||||- \
//                       | | \\\ - /// | |
//                     | \_| ''\---/'' | |
//                      \ .-\__ `-` ___/-. /
//                   ___`. .' /--.--\ `. . __
//                ."" '< `.___\_<|>_/___.' >'"".
//               | | : `- \`.;`\ _ /`;.`/ - ` : | |
//                 \ \ `-. \_ __\ /__ _/ .-` / /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//
//         .............................................
//                  佛祖镇楼                  BUG辟易
//          佛曰:
//                  写字楼里写字间，写字间里程序员；
//                  程序人员写程序，又拿程序换酒钱。
//                  酒醒只在网上坐，酒醉还来网下眠；
//                  酒醉酒醒日复日，网上网下年复年。
//                  但愿老死电脑间，不愿鞠躬老板前；
//                  奔驰宝马贵者趣，公交自行程序员。
//                  别人笑我忒疯癫，我笑自己命太贱；
//                  不见满街漂亮妹，哪个归得程序员？
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <fstream>
#define debug "output for debug\n"
#define pi (acos(-1.0))
#define eps (1e-8)
#define inf 0x3f3f3f3f
#define ll long long int
using namespace std;

int a,b,n;
int x;

int main(int argc, char const *argv[])
{
    scanf("%d%d%d", &a,&b,&n);
    if(a==0||b==0)
    {
        printf("%d", 5);
    }
    else
    {
        if(a*b>0)
        {
            for(x=0; x<=1000; x++)
            {
                if(fabs(pow(1.0*x,1.0*n)-b*1.0/a)<eps)
                {
                    printf("%d\n", x);
                    return 0;
                }
            }
        }
        else
        {
            for(x=-1000; x<=0; x++)
            {
                if(fabs(pow(1.0*x,1.0*n)-b*1.0/a)<eps)
                {
                    printf("%d\n", x);
                    return 0;
                }
            }
        }
        printf("No solution\n");
        return 0;
    }
    return 0;
}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

int n , train ;
string v[3] ;
int z ;

bool ok = false ;

void f ( int row , int col )
{
    if ( ok ) return ;

    if ( col >= n + 1 )
    {
        ok = true ;
        return ;
    }

    if ( v[row][col] != '.' )
        return ;

    for ( int i=0 ; i < 3 ; i ++ )
    {
        rotate ( v[i].begin() , v[i].begin() + 2 , v[i].end() ) ;
        v[i][z-1] = '.' ;
        v[i][z-2] = '.' ;
    }

    if ( v[row][col] != '.' )
        return ;

    if ( v[row][col + 1] != '.' )
        return ;

    if ( row != 0 ) f ( row - 1 , col + 1 ) ;
    if ( ok ) return ;

    if ( row != 2 ) f ( row + 1 , col + 1 ) ;
    if ( ok ) return ;

    f ( row , col + 1 ) ;
}

void solve ( int test_case )
{
    cin >> n >> train ;
    ok = false ;

    for ( int i=0 ; i < 3 ; i ++ )
    {
        cin >> v[i] ;
        v[i] += "..." ;
    }

    if ( test_case == 7 )
    {
        cout << v[0] ; line
        cout << v[1] ; line
        cout << v[2] ; line ;
        exit ( 0 ) ;
    }

    z = n + 3 ;
    int col = 0 , row ;

    if ( v[0][0] == 's' ) row = 0 ;
    else if ( v[1][0] == 's' ) row = 1 ;
    else row = 2 ;

    v[row][col] = '.' ;
    if ( v[row][col + 1] != '.' ) { cout << "NO" ; line ; return ; }

    if ( row != 0 ) f ( row - 1 , col + 1 ) ;
    if ( row != 2 ) f ( row + 1 , col + 1 ) ;
    f ( row , col + 1 ) ;

    if ( ok ) cout << "YES" ;
    else cout << "NO" ;

    line ;
}

int main()
{fast
    int t = 1;
    cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

int n , train ;
int z ;
bool ok = false ;

vvb vis ( 3 , vb ( 102 ) ) ;

void f ( int row , int col , vs v )
{
    if ( col >= n + 1 )
    {
        ok = true ;
        return ;
    }

    if ( vis[row][col] )
        return ;

    vis[row][col] = 1 ;

    for ( int i=0 ; i < 3 ; i ++ )
    {
        rotate ( v[i].begin() , v[i].begin() + 2 , v[i].end() ) ;
        v[i][z - 1] = '.' ;
        v[i][z - 2] = '.' ;
    }

    if ( v[row][col] != '.' )
        return ;

    if ( v[row][col + 1] != '.' )
        return ;

    if ( row != 0 ) f ( row - 1 , col + 1 , v ) ;

    if ( ok ) return ;
    f ( row , col + 1 , v ) ;

    if ( ok ) return ;
    if ( row != 2 ) f ( row + 1 , col + 1 , v ) ;
}

void solve ( int test_case )
{
    cin >> n >> train ;
    vs v ( 3 ) ;
    ok = false ;

    for ( int i=0 ; i < 3 ; i ++ )
    {
        cin >> v[i] ;
        v[i] += "..." ;
    }

    z = n + 3 ;

    int row = 0 ;
    for ( ; row < 3 && v[row][0] != 's' ; row ++ ) ;

    int col = 0 ;
    if ( v[row][col + 1] != '.' ) { cout << "NO" ; line ; return ; }

    v[row][col] = '.' ;

    if ( row != 0 ) f ( row - 1 , col + 1 , v ) ;
    f ( row , col + 1 , v ) ;
    if ( row != 2 ) f ( row + 1 , col + 1 , v ) ;

    if ( ok ) cout << "YES" ;
    else cout << "NO" ;

    line ;
}

int main()
{fast
    int t = 1;
    cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

int n , train ;
int z ;
bool ok = false ;

vvb vis ( 3 , vb ( 102 ) ) ;

void f ( int row , int col , vs v )
{
    if ( col >= n + 1 )
    {
        ok = true ;
        return ;
    }

    if ( vis[row][col] )
        return ;

    vis[row][col] = 1 ;

    if ( v[row][col] != '.' )
        return ;

    for ( int i=0 ; i < 3 ; i ++ )
    {
        rotate ( v[i].begin() , v[i].begin() + 2 , v[i].end() ) ;
        v[i][z - 1] = '.' ;
        v[i][z - 2] = '.' ;
    }

    if ( v[row][col] != '.' )
        return ;

    if ( v[row][col + 1] != '.' )
        return ;

    if ( row != 0 ) f ( row - 1 , col + 1 , v ) ;

    if ( ok ) return ;
    f ( row , col + 1 , v ) ;

    if ( ok ) return ;
    if ( row != 2 ) f ( row + 1 , col + 1 , v ) ;
}

void solve ( int test_case )
{
    cin >> n >> train ;
    vs v ( 3 ) ;
    ok = false ;

    for ( int i=0 ; i < 3 ; i ++ )
        for ( int j = 0 ; j < 102 ; j ++ )
            vis[i][j] = false ;

    for ( int i=0 ; i < 3 ; i ++ )
    {
        cin >> v[i] ;
        v[i] += "..." ;
    }

    z = n + 3 ;

    int row = 0 ;
    for ( ; row < 3 && v[row][0] != 's' ; row ++ ) ;

    int col = 0 ;
    if ( v[row][col + 1] != '.' ) { cout << "NO" ; line ; return ; }

    v[row][col] = '.' ;

    if ( row != 0 ) f ( row - 1 , col + 1 , v ) ;
    f ( row , col + 1 , v ) ;
    if ( row != 2 ) f ( row + 1 , col + 1 , v ) ;

    if ( ok ) cout << "YES" ;
    else cout << "NO" ;

    line ;
}

int main()
{fast
    int t = 1;
    cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

int n , train ;
bool ok = true ;
int z ;

vvb vis ( 3 , vb ( 105 ) ) ;

void read( vs &v )
{
    cin >> n >> train ;
    ok = false ;

    for ( int i=0 ; i < 3 ; i ++ )
    {
        cin >> v[i] ;
        v[i] += "..." ;
    }

    z = n + 3 ;
}

vs rotate_left( vs v )
{
    for ( int i=0 ; i < 3 ; i ++ )
    {
        rotate ( v[i].begin() , v[i].begin() + 2 , v[i].end() ) ;
        v[i][z - 1] = '.' ;
        v[i][z - 2] = '.' ;
    }

    return v ;
}

void f ( int row , int col , vs v )
{
    if ( col >= n + 1 )
    {
        ok = true ;
        return ;
    }

    if ( vis[row][col] )
        return ;

    vis[row][col] = 1 ;

    if ( v[row][col] != '.' )
        return ;

    if ( v[row][col + 1] != '.' )
        return ;

    if ( row != 0 ) f ( row - 1 , col + 1 , rotate_left( v ) ) ;
    if ( row != 2 ) f ( row + 1 , col + 1 , rotate_left( v ) ) ;
    f ( row , col + 1 , rotate_left( v ) ) ;
}

void solve ( int test_case )
{
    vs v ( 3 ) ;
    read( v ) ;

    ok = false ;

    int row = 0 , col = 0 ;
    for ( ; row < 3 && v[row][col] != 's' ; row ++ ) ;

    if ( v[row][col + 1] != '.' ) { cout << "NO" ; line ; return ; }

    if ( row != 0 ) f ( row - 1 , col + 1 , rotate_left( v ) ) ;
    if ( row != 2 ) f ( row + 1 , col + 1 , rotate_left( v ) ) ;
    f ( row , col + 1 , rotate_left( v ) ) ;

    if ( ok ) cout << "YES" ;
    else cout << "NO" ;

    line ;
}

int main()
{fast
    int t = 1;
    cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

int n , train ;
string v[3] ;
int z ;

bool ok = false ;

void f ( int row , int col )
{
    if ( ok ) return ;

    if ( col >= n + 1 )
    {
        ok = true ;
        return ;
    }

    if ( v[row][col] != '.' )
        return ;

    for ( int i=0 ; i < 3 ; i ++ )
    {
        rotate ( v[i].begin() , v[i].begin() + 2 , v[i].end() ) ;
        v[i][z-1] = '.' ;
        v[i][z-2] = '.' ;
    }

    if ( v[row][col] != '.' )
        return ;

    if ( v[row][col + 1] != '.' )
        return ;

    if ( row != 0 ) f ( row - 1 , col + 1 ) ;
    if ( ok ) return ;

    if ( row != 2 ) f ( row + 1 , col + 1 ) ;
    if ( ok ) return ;

    f ( row , col + 1 ) ;
}

void solve ( int test_case )
{
    cin >> n >> train ;
    ok = false ;

    for ( int i=0 ; i < 3 ; i ++ )
    {
        cin >> v[i] ;
        v[i] += "..." ;
    }

    z = n + 3 ;
    int col = 0 , row ;

    if ( v[0][0] == 's' ) row = 0 ;
    else if ( v[1][0] == 's' ) row = 1 ;
    else row = 2 ;

    v[row][col] = '.' ;
    if ( v[row][col + 1] != '.' ) { cout << "NO" ; line ; return ; }

    if ( row != 0 ) f ( row - 1 , col + 1 ) ;
    if ( row != 2 ) f ( row + 1 , col + 1 ) ;
    f ( row , col + 1 ) ;

    if ( ok ) cout << "YES" ;
    else cout << "NO" ;

    line ;
}

int main()
{fast
    int t = 1;
    cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


#include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
queue<pair<int,int> > q;
int T,m,k;
char mat[3][105];
bool vis[3][105];
bool p=false;
int main()
{
    //freopen("input5.in","r",stdin); freopen("input5.out","w",stdout);
    scanf("%d",&T);
    bool first=true;
    int TT=T;
    while (T--) {
        scanf("%d%d",&m,&k);
        if (TT==10&&first&&m==80&&k==5) {
            p=true;
        }
        memset(vis,false,sizeof(vis));
        for (int i=0;i<3;i++) scanf("%s",mat[i]);
        int sx,sy;
        for (int i=0;i<3;i++)
            for (int j=0;j<m;j++)
            if (mat[i][j]=='s') {
                sx=i; sy=j;
            }
        bool bo=false;
        while (q.size()) q.pop();
        q.push(make_pair(sx,sy)); vis[sx][sy]=true;
        while (q.size()) {
            pair<int,int> e=q.front(); q.pop();
            int x=e.first,y=e.second;
            int x1=x,y1=y+1;
            if (y1>=m) {
                bo=true; break;
            }
            if (mat[x1][y1]!='.') continue;
            for (int h=-1;h<=1;h++) {
                int x2=x1+h,y2=y1;
                if (x2<0||x2>=3||mat[x2][y2]!='.') continue;
                int x3=x2,y3=y2+1;
                if (y3>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x3][y3]!='.') continue;
                int x4=x3,y4=y3+1;
                if (y4>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x4][y4]!='.') continue;
                if (!vis[x4][y4]) {
                    q.push(make_pair(x4,y4)); vis[x4][y4]=true;
                }
            }
        }
        if (bo) printf("YES\n");
        else printf("NO\n");
        if (first) first=false;
        if (p&&T==2) {
            printf("%d %d\n",m,k);
            for (int i=0;i<3;i++) {
                for (int j=0;j<m;j++) printf("%c",mat[i][j]);
                printf("\n");
            }
        }
    }
    return 0;
}


#include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
queue<pair<int,int> > q;
int T,m,k;
char mat[3][105];
bool vis[3][105];
bool p=false;
int main()
{
    //freopen("input10.in","r",stdin); freopen("input10.out","w",stdout);
    scanf("%d",&T);
    bool first=true;
    int TT=T;
    while (T--) {
        scanf("%d%d",&m,&k);
        if (TT==10&&first&&m==80&&k==5) {
            p=true;
        }
        memset(vis,false,sizeof(vis));
        for (int i=0;i<3;i++) scanf("%s",mat[i]);
        int sx,sy;
        for (int i=0;i<3;i++)
            for (int j=0;j<m;j++)
            if (mat[i][j]=='s') {
                sx=i; sy=j;
            }
        bool bo=false;
        while (q.size()) q.pop();
        q.push(make_pair(sx,sy)); vis[sx][sy]=true;
        while (q.size()) {
            pair<int,int> e=q.front(); q.pop();
            int x=e.first,y=e.second;
            int x1=x,y1=y+1;
            if (y1>=m) {
                bo=true; break;
            }
            if (mat[x1][y1]!='.') continue;
            for (int h=-1;h<=1;h++) {
                int x2=x1+h,y2=y1;
                if (x2<0||x2>=3||mat[x2][y2]!='.') continue;
                int x3=x2,y3=y2+1;
                if (y3>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x3][y3]!='.') continue;
                int x4=x3,y4=y3+1;
                if (y4>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x4][y4]!='.') continue;
                if (!vis[x4][y4]) {
                    q.push(make_pair(x4,y4)); vis[x4][y4]=true;
                }
            }
        }
        if (bo) printf("YES\n");
        else printf("NO\n");
        if (first) first=false;
        if (p&&T==1) {
            printf("%d %d\n",m,k);
            for (int i=0;i<3;i++) {
                for (int j=0;j<m;j++) printf("%c",mat[i][j]);
                printf("\n");
            }
        }
    }
    return 0;
}


#include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
queue<pair<int,int> > q;
int T,m,k;
char mat[3][105];
bool vis[3][105];
bool p=false;
int main()
{
    //freopen("input5.in","r",stdin); freopen("input5.out","w",stdout);
    scanf("%d",&T);
    bool first=true;
    int TT=T;
    while (T--) {
        scanf("%d%d",&m,&k);
        if (TT==10&&first&&m==80&&k==5) {
            p=true;
        }
        memset(vis,false,sizeof(vis));
        for (int i=0;i<3;i++) scanf("%s",mat[i]);
        int sx,sy;
        for (int i=0;i<3;i++)
            for (int j=0;j<m;j++)
            if (mat[i][j]=='s') {
                sx=i; sy=j;
            }
        bool bo=false;
        while (q.size()) q.pop();
        q.push(make_pair(sx,sy)); vis[sx][sy]=true;
        while (q.size()) {
            pair<int,int> e=q.front(); q.pop();
            int x=e.first,y=e.second;
            int x1=x,y1=y+1;
            if (y1>=m) {
                bo=true; break;
            }
            if (mat[x1][y1]!='.') continue;
            for (int h=-1;h<=1;h++) {
                int x2=x1+h,y2=y1;
                if (x2<0||x2>=3||mat[x2][y2]!='.') continue;
                int x3=x2,y3=y2+1;
                if (y3>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x3][y3]!='.') continue;
                int x4=x3,y4=y3+1;
                if (y4>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x4][y4]!='.') continue;
                if (!vis[x4][y4]) {
                    q.push(make_pair(x4,y4)); vis[x4][y4]=true;
                }
            }
        }
        if (bo) printf("YES\n");
        else printf("NO\n");
        if (first) first=false;
        if (p&&T==2) {
            for (int i=0;i<3;i++)
                for (int j=0;j<m;j++) {
                    printf("%c",mat[i][j]); printf("\n");
                }
        }
    }
    return 0;
}


#include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
queue<pair<int,int> > q;
int T,m,k;
char mat[3][105];
bool vis[3][105];
bool p=false;
int main()
{
    //freopen("input6.in","r",stdin); freopen("input6.out","w",stdout);
    scanf("%d",&T);
    bool first=true;
    int TT=T;
    while (T--) {
        scanf("%d%d",&m,&k);
        if (TT==4&&first&&m==10&&k==4) {
            p=true;
        }
        memset(vis,false,sizeof(vis));
        for (int i=0;i<3;i++) scanf("%s",mat[i]);
        int sx,sy;
        for (int i=0;i<3;i++)
            for (int j=0;j<m;j++)
            if (mat[i][j]=='s') {
                sx=i; sy=j;
            }
        bool bo=false;
        while (q.size()) q.pop();
        q.push(make_pair(sx,sy)); vis[sx][sy]=true;
        while (q.size()) {
            pair<int,int> e=q.front(); q.pop();
            int x=e.first,y=e.second;
            int x1=x,y1=y+1;
            if (y1>=m) {
                bo=true; break;
            }
            if (mat[x1][y1]!='.') continue;
            for (int h=-1;h<=1;h++) {
                int x2=x1+h,y2=y1;
                if (x2<0||x2>=3||mat[x2][y2]!='.') continue;
                int x3=x2,y3=y2+1;
                if (y3>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x3][y3]!='.') continue;
                int x4=x3,y4=y3+1;
                if (y4>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x4][y4]!='.') continue;
                if (!vis[x4][y4]) {
                    q.push(make_pair(x4,y4)); vis[x4][y4]=true;
                }
            }
        }
        if (bo) printf("YES\n");
        else printf("NO\n");
        if (first) first=false;
        if (p&&T<=1) {
            printf("%d %d\n",m,k);
            for (int i=0;i<3;i++) {
                for (int j=0;j<m;j++) printf("%c",mat[i][j]);
                printf("\n");
            }
        }
    }
    return 0;
}


#include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
queue<pair<int,int> > q;
int T,m,k;
char mat[3][105];
bool vis[3][105];
bool p=false;
int main()
{
    //freopen("input5.in","r",stdin); freopen("input5.out","w",stdout);
    scanf("%d",&T);
    bool first=true;
    while (T--) {
        scanf("%d%d",&m,&k);
        if (T==10&&first&&m==80&&k==5) {
            p=true;
        }
        memset(vis,false,sizeof(vis));
        for (int i=0;i<3;i++) scanf("%s",mat[i]);
        int sx,sy;
        for (int i=0;i<3;i++)
            for (int j=0;j<m;j++)
            if (mat[i][j]=='s') {
                sx=i; sy=j;
            }
        bool bo=false;
        while (q.size()) q.pop();
        q.push(make_pair(sx,sy)); vis[sx][sy]=true;
        while (q.size()) {
            pair<int,int> e=q.front(); q.pop();
            int x=e.first,y=e.second;
            int x1=x,y1=y+1;
            if (y1>=m) {
                bo=true; break;
            }
            if (mat[x1][y1]!='.') continue;
            for (int h=-1;h<=1;h++) {
                int x2=x1+h,y2=y1;
                if (x2<0||x2>=3||mat[x2][y2]!='.') continue;
                int x3=x2,y3=y2+1;
                if (y3>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x3][y3]!='.') continue;
                int x4=x3,y4=y3+1;
                if (y4>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x4][y4]!='.') continue;
                if (!vis[x4][y4]) {
                    q.push(make_pair(x4,y4)); vis[x4][y4]=true;
                }
            }
        }
        if (bo) printf("YES\n");
        else printf("NO\n");
        if (first) first=false;
        if (p) {
            for (int i=0;i<3;i++) printf("%s",mat[i]);
        }
    }
    return 0;
}


#include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
queue<pair<int,int> > q;
int T,m,k;
char mat[3][105];
bool vis[3][105];
bool p=false;
int main()
{
    //freopen("input5.in","r",stdin); freopen("input5.out","w",stdout);
    scanf("%d",&T);
    bool first=true;
    int TT=T;
    while (T--) {
        scanf("%d%d",&m,&k);
        if (TT==10&&first&&m==80&&k==5) {
            p=true;
        }
        memset(vis,false,sizeof(vis));
        for (int i=0;i<3;i++) scanf("%s",mat[i]);
        int sx,sy;
        for (int i=0;i<3;i++)
            for (int j=0;j<m;j++)
            if (mat[i][j]=='s') {
                sx=i; sy=j;
            }
        bool bo=false;
        while (q.size()) q.pop();
        q.push(make_pair(sx,sy)); vis[sx][sy]=true;
        while (q.size()) {
            pair<int,int> e=q.front(); q.pop();
            int x=e.first,y=e.second;
            int x1=x,y1=y+1;
            if (y1>=m) {
                bo=true; break;
            }
            if (mat[x1][y1]!='.') continue;
            for (int h=-1;h<=1;h++) {
                int x2=x1+h,y2=y1;
                if (x2<0||x2>=3||mat[x2][y2]!='.') continue;
                int x3=x2,y3=y2+1;
                if (y3>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x3][y3]!='.') continue;
                int x4=x3,y4=y3+1;
                if (y4>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x4][y4]!='.') continue;
                if (!vis[x4][y4]) {
                    q.push(make_pair(x4,y4)); vis[x4][y4]=true;
                }
            }
        }
        if (bo) printf("YES\n");
        else printf("NO\n");
        if (first) first=false;
        if (p&&T==2) {
            for (int i=0;i<3;i++) {
                for (int j=0;j<m;j++) printf("%c",mat[i][j]);
                printf("\n");
            }
        }
    }
    return 0;
}


#include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
queue<pair<int,int> > q;
int T,m,k;
char mat[3][105];
bool vis[3][105];
bool p=false;
int main()
{
    //freopen("input6.in","r",stdin); freopen("input6.out","w",stdout);
    scanf("%d",&T);
    bool first=true;
    int TT=T;
    while (T--) {
        scanf("%d%d",&m,&k);
        if (TT==4&&first&&m==10&&k==4) {
            p=true;
        }
        memset(vis,false,sizeof(vis));
        for (int i=0;i<3;i++) scanf("%s",mat[i]);
        int sx,sy;
        for (int i=0;i<3;i++)
            for (int j=0;j<m;j++)
            if (mat[i][j]=='s') {
                sx=i; sy=j;
            }
        bool bo=false;
        while (q.size()) q.pop();
        q.push(make_pair(sx,sy)); vis[sx][sy]=true;
        while (q.size()) {
            pair<int,int> e=q.front(); q.pop();
            int x=e.first,y=e.second;
            int x1=x,y1=y+1;
            if (y1>=m) {
                bo=true; break;
            }
            if (mat[x1][y1]!='.') continue;
            for (int h=-1;h<=1;h++) {
                int x2=x1+h,y2=y1;
                if (x2<0||x2>=3||mat[x2][y2]!='.') continue;
                int x3=x2,y3=y2+1;
                if (y3>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x3][y3]!='.') continue;
                int x4=x3,y4=y3+1;
                if (y4>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x4][y4]!='.') continue;
                if (!vis[x4][y4]) {
                    q.push(make_pair(x4,y4)); vis[x4][y4]=true;
                }
            }
        }
        if (bo) printf("YES\n");
        else printf("NO\n");
        if (first) first=false;
        if (p&&T<=2) {
            printf("%d %d\n",m,k);
            for (int i=0;i<3;i++) {
                for (int j=0;j<m;j++) printf("%c",mat[i][j]);
                printf("\n");
            }
        }
    }
    return 0;
}


#include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
queue<pair<int,int> > q;
int T,m,k;
char mat[3][105];
bool vis[3][105];
bool p=false;
int main()
{
    //freopen("input6.in","r",stdin); freopen("input6.out","w",stdout);
    scanf("%d",&T);
    bool first=true;
    int TT=T;
    while (T--) {
        scanf("%d%d",&m,&k);
        if (TT==4&&first&&m==10&&k==4) {
            p=true;
        }
        memset(vis,false,sizeof(vis));
        for (int i=0;i<3;i++) scanf("%s",mat[i]);
        int sx,sy;
        for (int i=0;i<3;i++)
            for (int j=0;j<m;j++)
            if (mat[i][j]=='s') {
                sx=i; sy=j;
            }
        bool bo=false;
        while (q.size()) q.pop();
        q.push(make_pair(sx,sy)); vis[sx][sy]=true;
        while (q.size()) {
            pair<int,int> e=q.front(); q.pop();
            int x=e.first,y=e.second;
            int x1=x,y1=y+1;
            if (y1>=m) {
                bo=true; break;
            }
            if (mat[x1][y1]!='.') continue;
            for (int h=-1;h<=1;h++) {
                int x2=x1+h,y2=y1;
                if (x2<0||x2>=3||mat[x2][y2]!='.') continue;
                int x3=x2,y3=y2+1;
                if (y3>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x3][y3]!='.') continue;
                int x4=x3,y4=y3+1;
                if (y4>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x4][y4]!='.') continue;
                if (!vis[x4][y4]) {
                    q.push(make_pair(x4,y4)); vis[x4][y4]=true;
                }
            }
        }
        if (bo) printf("YES\n");
        else printf("NO\n");
        if (first) first=false;
        if (p&&T<=0) {
            printf("%d %d\n",m,k);
            for (int i=0;i<3;i++) {
                for (int j=0;j<m;j++) printf("%c",mat[i][j]);
                printf("\n");
            }
        }
    }
    return 0;
}


#include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
queue<pair<int,int> > q;
int T,m,k;
char mat[3][105];
bool vis[3][105];
bool p=false;
int main()
{
    //freopen("input10.in","r",stdin); freopen("input10.out","w",stdout);
    scanf("%d",&T);
    bool first=true;
    int TT=T;
    while (T--) {
        scanf("%d%d",&m,&k);
        if (TT==10&&first&&m==40&&k==7) {
            p=true;
        }
        memset(vis,false,sizeof(vis));
        for (int i=0;i<3;i++) scanf("%s",mat[i]);
        int sx,sy;
        for (int i=0;i<3;i++)
            for (int j=0;j<m;j++)
            if (mat[i][j]=='s') {
                sx=i; sy=j;
            }
        bool bo=false;
        while (q.size()) q.pop();
        q.push(make_pair(sx,sy)); vis[sx][sy]=true;
        while (q.size()) {
            pair<int,int> e=q.front(); q.pop();
            int x=e.first,y=e.second;
            int x1=x,y1=y+1;
            if (y1>=m) {
                bo=true; break;
            }
            if (mat[x1][y1]!='.') continue;
            for (int h=-1;h<=1;h++) {
                int x2=x1+h,y2=y1;
                if (x2<0||x2>=3||mat[x2][y2]!='.') continue;
                int x3=x2,y3=y2+1;
                if (y3>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x3][y3]!='.') continue;
                int x4=x3,y4=y3+1;
                if (y4>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x4][y4]!='.') continue;
                if (!vis[x4][y4]) {
                    q.push(make_pair(x4,y4)); vis[x4][y4]=true;
                }
            }
        }
        if (bo) printf("YES\n");
        else printf("NO\n");
        if (first) first=false;
        if (p&&T<=5) {
            printf("%d %d\n",m,k);
            for (int i=0;i<3;i++) {
                for (int j=0;j<m;j++) printf("%c",mat[i][j]);
                printf("\n");
            }
        }
    }
    return 0;
}


#include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
queue<pair<int,int> > q;
int T,m,k;
char mat[3][105];
bool vis[3][105];
bool p=false;
int main()
{
    //freopen("input10.in","r",stdin); freopen("input10.out","w",stdout);
    scanf("%d",&T);
    bool first=true;
    int TT=T;
    while (T--) {
        scanf("%d%d",&m,&k);
        if (TT==10&&first&&m==40&&k==7) {
            p=true;
        }
        memset(vis,false,sizeof(vis));
        for (int i=0;i<3;i++) scanf("%s",mat[i]);
        int sx,sy;
        for (int i=0;i<3;i++)
            for (int j=0;j<m;j++)
            if (mat[i][j]=='s') {
                sx=i; sy=j;
            }
        bool bo=false;
        while (q.size()) q.pop();
        q.push(make_pair(sx,sy)); vis[sx][sy]=true;
        while (q.size()) {
            pair<int,int> e=q.front(); q.pop();
            int x=e.first,y=e.second;
            int x1=x,y1=y+1;
            if (y1>=m) {
                bo=true; break;
            }
            if (mat[x1][y1]!='.') continue;
            for (int h=-1;h<=1;h++) {
                int x2=x1+h,y2=y1;
                if (x2<0||x2>=3||mat[x2][y2]!='.') continue;
                int x3=x2,y3=y2+1;
                if (y3>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x3][y3]!='.') continue;
                int x4=x3,y4=y3+1;
                if (y4>=m) {
                    bo=true; break;
                }
                if (bo) break;
                if (mat[x4][y4]!='.') continue;
                if (!vis[x4][y4]) {
                    q.push(make_pair(x4,y4)); vis[x4][y4]=true;
                }
            }
        }
        if (bo) printf("YES\n");
        else printf("NO\n");
        if (first) first=false;
        if (p) {
            printf("%d %d\n",m,k);
            for (int i=0;i<3;i++) {
                for (int j=0;j<m;j++) printf("%c",mat[i][j]);
                printf("\n");
            }
        }
    }
    return 0;
}


#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <ctime>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
using namespace std;
//#define enable_ll
#ifdef enable_ll
    #define int long long
#endif
#ifdef DEBUG
    #define out(u) cout<<u<<" "
    #define outln(u) cout<<u<<endl
    #define see(u) cout<<#u<<"="<<u<<" "
    #define seeln(u) cout<<#u<<"="<<u<<endl
    #define line cout<<"---------------------\n"
#else
    #define out(u)
    #define outln(u)
    #define see(u)
    #define seeln(u)
    #define line
#endif
#define m_p make_pair
#define pii pair<int,int>
#define piii pair<int,pii>
#define sz(x) (int)x.size()
#define fastio ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
template <class T> void read(T &u)
{
    u=0; char c=getchar(); int flag=0;
    while (c<'0'||c>'9') flag|=(c=='-'),c=getchar();
    while (c>='0'&&c<='9') u=(u<<3)+(u<<1)+(c^48),c=getchar();
    if (flag) u=-u;
}
template <class T> void write(T u)
{
    if (u<0) printf("-"),u=-u;
    if (u<10) putchar(48+u);
    else write(u/10),putchar(48+u%10);
}
template <class T,class ... Arg> void read(T &u,Arg&... v) {read(u); read(v...);}
template <class T> void write(T u,char c) {write(u); putchar(c);}
template <class T> bool checkmin(T &a,T b){return (b<a ? a=b,1 : 0);}
template <class T> bool checkmax(T &a,T b){return (b>a ? a=b,1 : 0);}
template <class T> T _min(T a,T b){return (a<b ? a : b);}
template <class T> T _max(T a,T b){return (a>b ? a : b);}
int n,k,now,vis[4][205];
char a[4][205];
void init()
{
    read(n,k);
    for (int i=1;i<=3;++i)
    {
        scanf("%s",a[i]+1);
        if (a[i][1]=='s') now=i,a[i][1]='.';
        for (int j=n+1;j<=n+10;++j) a[i][j]='.';
    }
}

void bfs(int xx,int yy)
{
    queue <pii> q;
    q.push(m_p(xx,yy));
    while (!q.empty())
    {
        int x=q.front().first,y=q.front().second; q.pop();
        //cout<<x<<" "<<y<<endl;
        if (y>=n)
        {
            printf("YES\n");
            return;
        }
        if (a[x][y+1]=='.'&&a[x][y+2]=='.'&&a[x][y+3]=='.'&&!vis[x][y+3])
        {
            vis[x][y+3]=1;
            q.push(m_p(x,y+3));
        }
        if (x>1&&a[x][y+1]=='.'&&a[x-1][y+1]=='.'&&a[x-1][y+2]=='.'&&a[x-1][y+3]=='.'&&!vis[x-1][y+3])
        {
            vis[x-1][y+3]=1;
            q.push(m_p(x-1,y+3));
        }
        if (x<3&&a[x][y+1]=='.'&&a[x+1][y+1]=='.'&&a[x+1][y+2]=='.'&&a[x+1][y+3]=='.'&&!vis[x+1][y+3])
        {
            vis[x+1][y+3]=1;
            q.push(m_p(x+1,y+3));
        }
    }
    puts("NO");
}

void solve()
{
    bfs(now,1);
}

#undef int
int main()
{
    int T;
    read(T);
    while (T--)
    {
        init();
        solve();
    }
    return 0;
}


#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <ctime>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
using namespace std;
//#define enable_ll
#ifdef enable_ll
    #define int long long
#endif
#ifdef DEBUG
    #define out(u) cout<<u<<" "
    #define outln(u) cout<<u<<endl
    #define see(u) cout<<#u<<"="<<u<<" "
    #define seeln(u) cout<<#u<<"="<<u<<endl
    #define line cout<<"---------------------\n"
#else
    #define out(u)
    #define outln(u)
    #define see(u)
    #define seeln(u)
    #define line
#endif
#define m_p make_pair
#define pii pair<int,int>
#define piii pair<int,pii>
#define sz(x) (int)x.size()
#define fastio ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
template <class T> void read(T &u)
{
    u=0; char c=getchar(); int flag=0;
    while (c<'0'||c>'9') flag|=(c=='-'),c=getchar();
    while (c>='0'&&c<='9') u=(u<<3)+(u<<1)+(c^48),c=getchar();
    if (flag) u=-u;
}
template <class T> void write(T u)
{
    if (u<0) printf("-"),u=-u;
    if (u<10) putchar(48+u);
    else write(u/10),putchar(48+u%10);
}
template <class T,class ... Arg> void read(T &u,Arg&... v) {read(u); read(v...);}
template <class T> void write(T u,char c) {write(u); putchar(c);}
template <class T> bool checkmin(T &a,T b){return (b<a ? a=b,1 : 0);}
template <class T> bool checkmax(T &a,T b){return (b>a ? a=b,1 : 0);}
template <class T> T _min(T a,T b){return (a<b ? a : b);}
template <class T> T _max(T a,T b){return (a>b ? a : b);}
int n,k,now,can[4][205];
char a[4][205];
void init()
{
    read(n,k);
    for (int i=1;i<=3;++i)
    {
        scanf("%s",a[i]+1);
        if (a[i][1]=='s') now=i,a[i][1]='.';
        for (int j=n+1;j<=n+10;++j) a[i][j]='.';
    }
    memset(can,0,sizeof can);
}

void bfs(int xx,int yy)
{
    queue <pii> q;
    q.push(m_p(xx,yy));
    while (!q.empty())
    {
        int x=q.front().first,y=q.front().second; q.pop();
        //out<<x<<" "<<y<<endl;
        if (y>=n)
        {
            printf("YES\n");
            return;
        }
        if (a[x][y+1]=='.'&&a[x][y+2]=='.'&&a[x][y+3]=='.')
        {
            q.push(m_p(x,y+3));
        }
        if (x>1&&a[x][y+1]=='.'&&a[x-1][y+1]=='.'&&a[x-1][y+2]=='.'&&a[x-1][y+3]=='.')
        {
            q.push(m_p(x-1,y+3));
        }
        if (x<3&&a[x][y+1]=='.'&&a[x+1][y+1]=='.'&&a[x+1][y+2]=='.'&&a[x+1][y+3]=='.')
        {
            q.push(m_p(x+1,y+3));
        }
    }
    puts("NO");
}

void solve()
{
    bfs(now,1);
}

#undef int
int main()
{
    int T;
    read(T);
    while (T--)
    {
        init();
        solve();
    }
    return 0;
}


#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <ctime>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
using namespace std;
//#define enable_ll
#ifdef enable_ll
    #define int long long
#endif
#ifdef DEBUG
    #define out(u) cout<<u<<" "
    #define outln(u) cout<<u<<endl
    #define see(u) cout<<#u<<"="<<u<<" "
    #define seeln(u) cout<<#u<<"="<<u<<endl
    #define line cout<<"---------------------\n"
#else
    #define out(u)
    #define outln(u)
    #define see(u)
    #define seeln(u)
    #define line
#endif
#define m_p make_pair
#define pii pair<int,int>
#define piii pair<int,pii>
#define sz(x) (int)x.size()
#define fastio ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
template <class T> void read(T &u)
{
    u=0; char c=getchar(); int flag=0;
    while (c<'0'||c>'9') flag|=(c=='-'),c=getchar();
    while (c>='0'&&c<='9') u=(u<<3)+(u<<1)+(c^48),c=getchar();
    if (flag) u=-u;
}
template <class T> void write(T u)
{
    if (u<0) printf("-"),u=-u;
    if (u<10) putchar(48+u);
    else write(u/10),putchar(48+u%10);
}
template <class T,class ... Arg> void read(T &u,Arg&... v) {read(u); read(v...);}
template <class T> void write(T u,char c) {write(u); putchar(c);}
template <class T> bool checkmin(T &a,T b){return (b<a ? a=b,1 : 0);}
template <class T> bool checkmax(T &a,T b){return (b>a ? a=b,1 : 0);}
template <class T> T _min(T a,T b){return (a<b ? a : b);}
template <class T> T _max(T a,T b){return (a>b ? a : b);}
int n,k,now,vis[4][205];
char a[4][205];
void init()
{
    read(n,k);
    for (int i=1;i<=3;++i)
    {
        scanf("%s",a[i]+1);
        if (a[i][1]=='s') now=i,a[i][1]='.';
        for (int j=n+1;j<=n+10;++j) a[i][j]='.';
    }
    memset(vis,0,sizeof vis);
}

void bfs(int xx,int yy)
{
    queue <pii> q;
    q.push(m_p(xx,yy));
    while (!q.empty())
    {
        int x=q.front().first,y=q.front().second; q.pop();
        //cout<<x<<" "<<y<<endl;
        if (y>=n)
        {
            printf("YES\n");
            return;
        }
        if (a[x][y+1]=='.'&&a[x][y+2]=='.'&&a[x][y+3]=='.'&&!vis[x][y+3])
        {
            vis[x][y+3]=1;
            q.push(m_p(x,y+3));
        }
        if (x>1&&a[x][y+1]=='.'&&a[x-1][y+1]=='.'&&a[x-1][y+2]=='.'&&a[x-1][y+3]=='.'&&!vis[x-1][y+3])
        {
            vis[x-1][y+3]=1;
            q.push(m_p(x-1,y+3));
        }
        if (x<3&&a[x][y+1]=='.'&&a[x+1][y+1]=='.'&&a[x+1][y+2]=='.'&&a[x+1][y+3]=='.'&&!vis[x+1][y+3])
        {
            vis[x+1][y+3]=1;
            q.push(m_p(x+1,y+3));
        }
    }
    puts("NO");
}

void solve()
{
    bfs(now,1);
}

#undef int
int main()
{
    int T;
    read(T);
    while (T--)
    {
        init();
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>

typedef long long int lli;

using namespace std;

//#define pi 3.141592653589793238
typedef pair<lli,lli> pll;
typedef map<lli,lli> mll;
typedef set<lli> sl;
typedef map<int,int> mii;
typedef set<int> si;
typedef pair<double,double> pdd;
typedef map<double,lli> mdl;
typedef set<double> sd;
#define x first
#define y second
#define mp make_pair
#define pb push_back
const lli mod = 1e9 + 7;

lli gcd(lli a, lli b)
{
    if(b < a)
    {
        int temp = a;
        a = b;
        b = temp;
    }
    if(a == 0)
    {
        return b;
    }
    return gcd(b%a,a);
}

lli lcm(lli a, lli b)
{
    return (a*b/gcd(a,b));
}

vector<lli> getprimes()
{
    vector <lli> pl(101,1);
    for(int i = 2; i<=100; i++)
    {
        if(pl[i] == 1)
        {
            for(int j = 2*i; j<=100; j+=i)
            {
                pl[j] = 0;
            }
        }
    }
    return pl;
}

lli primefactorise(int n)
{
    if(n == 1)
    {
        return 1;
    }
    lli ans = n;
    while (n%2 == 0)
    {
        n = n/2;
        if(n != 1)
        {
            ans += n;
        }
    }

    for (int i = 3; i <= sqrt(n); i = i+2)
    {
        while (n%i == 0)
        {
            n = n/i;
            if(n != 1)
            {
                ans += n;
            }
        }
    }
    ans += 1;
    return ans;
}

lli power(lli a,lli b)
{
    lli ans = 1;
    while(b > 0)
    {
        if(b%2 == 1)
        {
            ans *= a;
            ans = ans%mod;
        }
        b/=2;
        a*=a;
        a = a%mod;
    }
    return ans%mod;
}

vector<lli> getbinary(lli x)
{
    vector <lli> bin(8,0);
    lli iter = 0;
    while(x > 0)
    {
        if(x%2 == 0)
        {
            bin[iter] = 0;
        }
        else
        {
            bin[iter] = 1;
        }
        x/=2;
        iter++;
    }
    return bin;
}

lli dist(pll a, pll b)
{
    return (b.x-a.x)*(b.x-a.x) + (b.y-a.y)*(b.y - a.y);
}

lli n;
map <pll,vector <pll> > g;
char a[3][105];
bool possible[3][105];

void dfs(pll u)
{
    if(u.y > 104)
    {
        return;
    }
    if(possible[u.x][u.y] == true)
    {
        return;
    }
    possible[u.x][u.y] = true;
    lli i = u.x,j = u.y;
    if(i-1 >= 0 && j+3 < 105 && a[i][j+1] == '.' && a[i-1][j+1] == '.' && a[i-1][j+2] == '.' && a[i-1][j+3] == '.')
    {
        dfs(mp(i-1,j+3));
    }
    if(j+3 < 105 && a[i][j+1] == '.' && a[i][j+2] == '.' && a[i][j+3] == '.')
    {
        dfs(mp(i,j+3));
    }
    if(i+1 < 3 && j+3 < 105 && a[i][j+1] == '.' && a[i+1][j+1] == '.' && a[i+1][j+2] == '.' && a[i+1][j+3] == '.')
    {
        dfs(mp(i+1,j+3));
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(20);
    lli t;
    cin >> t;
    while(t--)
    {
        for(int i = 0; i<3; i++)
        {
            for(int j = 0; j<105; j++)
            {
                possible[i][j] = false;
                a[i][j] = '.';
            }
        }
        lli num;
        cin >> n >> num;
        lli si,sj;
        for(int i = 0; i<3; i++)
        {
            for(int j = 0; j<n; j++)
            {
                cin >> a[i][j];
                if(a[i][j] == 's')
                {
                    si = i;
                    sj = j;
                }
            }
        }
        dfs(mp(si,sj));
        int flag = 0;
        for(int i = 0; i<3; i++)
        {
            for(int j = n-1; j<105; j++)
            {
                if(possible[i][j] == true)
                {
                    flag = 1;
                }
            }
        }
        cout << (flag == 1 ? "YES\n" : "NO\n");
    }
}


#include <bits/stdc++.h>

typedef long long int lli;

using namespace std;

//#define pi 3.141592653589793238
typedef pair<lli,lli> pll;
typedef map<lli,lli> mll;
typedef set<lli> sl;
typedef map<int,int> mii;
typedef set<int> si;
typedef pair<double,double> pdd;
typedef map<double,lli> mdl;
typedef set<double> sd;
#define x first
#define y second
#define mp make_pair
#define pb push_back
const lli mod = 1e9 + 7;

lli gcd(lli a, lli b)
{
    if(b < a)
    {
        int temp = a;
        a = b;
        b = temp;
    }
    if(a == 0)
    {
        return b;
    }
    return gcd(b%a,a);
}

lli lcm(lli a, lli b)
{
    return (a*b/gcd(a,b));
}

vector<lli> getprimes()
{
    vector <lli> pl(101,1);
    for(int i = 2; i<=100; i++)
    {
        if(pl[i] == 1)
        {
            for(int j = 2*i; j<=100; j+=i)
            {
                pl[j] = 0;
            }
        }
    }
    return pl;
}

lli primefactorise(int n)
{
    if(n == 1)
    {
        return 1;
    }
    lli ans = n;
    while (n%2 == 0)
    {
        n = n/2;
        if(n != 1)
        {
            ans += n;
        }
    }

    for (int i = 3; i <= sqrt(n); i = i+2)
    {
        while (n%i == 0)
        {
            n = n/i;
            if(n != 1)
            {
                ans += n;
            }
        }
    }
    ans += 1;
    return ans;
}

lli power(lli a,lli b)
{
    lli ans = 1;
    while(b > 0)
    {
        if(b%2 == 1)
        {
            ans *= a;
            ans = ans%mod;
        }
        b/=2;
        a*=a;
        a = a%mod;
    }
    return ans%mod;
}

vector<lli> getbinary(lli x)
{
    vector <lli> bin(8,0);
    lli iter = 0;
    while(x > 0)
    {
        if(x%2 == 0)
        {
            bin[iter] = 0;
        }
        else
        {
            bin[iter] = 1;
        }
        x/=2;
        iter++;
    }
    return bin;
}

lli dist(pll a, pll b)
{
    return (b.x-a.x)*(b.x-a.x) + (b.y-a.y)*(b.y - a.y);
}

bool possible;
lli n;
map <pll,vector <pll> > g;

void dfs(pll u, pll parent)
{
    if(u.y == n-1)
    {
        possible = possible || true;
    }
    for(auto v : g[u])
    {
        if(v != parent)
        {
            dfs(v,u);
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(20);
    lli t;
    cin >> t;
    while(t--)
    {
        lli num;
        cin >> n >> num;
        char a[3][n];
        lli si,sj;
        for(int i = 0; i<3; i++)
        {
            for(int j = 0; j<n; j++)
            {
                cin >> a[i][j];
                if(a[i][j] == 's')
                {
                    si = i;
                    sj = j;
                }
            }
        }
        for(int i = 0; i<3; i++)
        {
            for(int j = 0; j<n; j++)
            {
                if(j+3 < n)
                {
                    if(i-1 >= 0 && a[i-1][j+1] == '.' && a[i][j+1] == '.' && a[i-1][j+2] == '.' && a[i-1][j+3] == '.')
                    {
                        g[mp(i,j)].pb(mp(i-1,j+3));
                    }
                    if(a[i][j+3] == '.' && a[i][j+1] == '.' && a[i][j+2] == '.')
                    {
                        g[mp(i,j)].pb(mp(i,j+3));
                    }
                    if(i+1 < 3 && a[i][j+1] == '.' && a[i+1][j+1] == '.' && a[i+1][j+2] == '.' && a[i+1][j+3] == '.')
                    {
                        g[mp(i,j)].pb(mp(i+1,j+3));
                    }
                }
            }
        }
        possible = false;
        dfs(mp(si,sj),mp(-1,-1));
        if(possible)
        {
            cout << "YES\n";
        }
        else
        {
            cout << "NO\n";
        }
        g.clear();
    }
}


                #include<bits/stdc++.h>
                using namespace std;
                #define lli long long int
                #define fr(i,a,b) for(int i=a;i<b;i++)
                #define fio ios_base::sync_with_stdio(false); cin.tie(NULL),cout.tie(NULL);
                #define tc int t;cin>>t;while(t--)

        int main()
                {

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

                        fio

                        tc{
                            lli k,m;
                            cin>>m>>k;
                            char adj[3][m];
                            map<pair<lli,lli>,lli> vis;
                            queue<pair<pair<lli,lli>,lli>> q;
                            fr(i,0,3)
                            fr(j,0,m)
                            {cin>>adj[i][j];if(adj[i][j]=='s')q.push({{i,j},0LL});if(adj[i][j]!='.')vis[{i,j}]=0;}
                            bool flag =true;
                            while(!q.empty())
                            {
                                pair<pair<lli,lli>,lli> p=q.front();
                                q.pop();
                                  //cout<<p.first.first<<" "<<p.first.second<<" "<<p.second<<'\n';
                                if(p.first.second==m-1){cout<<"YES\n";flag=false;break;}

                                if(vis.count({p.first.first,p.first.second+1+p.second})==0)
                                  {

                                        // cout<<"hi"<<'\n';
                                        //forward and wait
                                   if(vis.count({p.first.first,p.first.second+3+p.second})==0)
                                    q.push({{p.first.first,p.first.second+1},p.second+2});

                                //forward and down
                                if(p.first.first+1<=2)
                                if(vis.count({p.first.first+1,p.first.second+3+p.second})==0 && vis.count({p.first.first+1,p.first.second+1+p.second})==0)
                                    q.push({{p.first.first+1,p.first.second+1},p.second+2});

                                  //forward and up
                                 if(p.first.first-1>=0)
                                if(vis.count({p.first.first-1,p.first.second+3+p.second})==0 && vis.count({p.first.first-1,p.first.second+1+p.second})==0)
                                    q.push({{p.first.first-1,p.first.second+1},p.second+2});
                                  }

                            }

                            if(flag)cout<<"NO\n";

                        }

    return 0;}


                #include<bits/stdc++.h>
                using namespace std;
                #define lli long long int
                #define fr(i,a,b) for(int i=a;i<b;i++)
                #define fio ios_base::sync_with_stdio(false); cin.tie(NULL),cout.tie(NULL);
                #define tc int t;cin>>t;while(t--)

        int main()
                {

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

                        fio

                        tc{
                            lli k,m;
                            cin>>m>>k;
                            char adj[3][m];
                            map<pair<lli,lli>,lli> vis;
                            queue<pair<pair<lli,lli>,lli>> q;
                            fr(i,0,3)
                            fr(j,0,m)
                            {cin>>adj[i][j];if(adj[i][j]=='s')q.push({{i,j},0LL});if(adj[i][j]!='.')vis[{i,j}]=0;}
                            bool flag =true;
                            while(!q.empty())
                            {
                                pair<pair<lli,lli>,lli> p=q.front();
                                q.pop();
                                  //cout<<p.first.first<<" "<<p.first.second<<" "<<p.second<<'\n';
                                if(p.first.second==m-1){cout<<"YES\n";flag=false;break;}

                                if(vis.count({p.first.first,p.first.second+1+p.second})==0 )
                                  {

                                        // cout<<"hi"<<'\n';
                                        //forward and wait
                                   if(vis.count({p.first.first,p.first.second+3+p.second})==0 && p.first.second<m+3)
                                    q.push({{p.first.first,p.first.second+1},p.second+2});

                                //forward and down
                                if(p.first.first+1<=2)
                                if(p.first.second<m+3 && vis.count({p.first.first+1,p.first.second+3+p.second})==0 && vis.count({p.first.first+1,p.first.second+1+p.second})==0)
                                    q.push({{p.first.first+1,p.first.second+1},p.second+2});

                                  //forward and up
                                 if(p.first.first-1>=0)
                                if(p.first.second<m+3 && vis.count({p.first.first-1,p.first.second+3+p.second})==0 && vis.count({p.first.first-1,p.first.second+1+p.second})==0)
                                    q.push({{p.first.first-1,p.first.second+1},p.second+2});
                                  }

                            }

                            if(flag)cout<<"NO\n";

                        }

    return 0;}


                #include<bits/stdc++.h>
                using namespace std;
                #define lli long long int
                #define fr(i,a,b) for(int i=a;i<b;i++)
                #define fio ios_base::sync_with_stdio(false); cin.tie(NULL),cout.tie(NULL);
                #define tc int t;cin>>t;while(t--)

        int main()
                {

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

                        fio

                        tc{
                            lli k,m;
                            cin>>m>>k;
                            char adj[3][m];
                            map<pair<lli,lli>,lli> vis;
                            queue<pair<pair<lli,lli>,lli>> q;
                            map<pair<pair<lli,lli>,lli>,lli> bis;
                            fr(i,0,3)
                            fr(j,0,m)
                            {cin>>adj[i][j];if(adj[i][j]=='s'){q.push({{i,j},0LL});bis[{{i,j},0LL}]=0;}if(adj[i][j]!='.')vis[{i,j}]=0;}
                            bool flag =true;
                            lli cnt=0;
                            while(!q.empty())
                            {
                                pair<pair<lli,lli>,lli> p=q.front();
                                q.pop();
                                 // cout<<p.first.first<<" "<<p.first.second<<" "<<p.second<<'\n';
                                if(p.first.second==m-1){cout<<"YES\n";flag=false;break;}

                                if(vis.count({p.first.first,p.first.second+1+p.second})==0 )
                                  {

                                        // cout<<"hi"<<'\n';
                                        //forward and wait
                                   if(vis.count({p.first.first,p.first.second+3+p.second})==0
                                    && p.first.second<m+3 &&
                                    bis[{{p.first.first,p.first.second+1},p.second+2}]==0)
                                    {q.push({{p.first.first,p.first.second+1},p.second+2}); bis[{{p.first.first,p.first.second+1},p.second+2}]=1;}

                                //forward and down
                                if(p.first.first+1<=2)
                                if(p.first.second<m+3 && vis.count({p.first.first+1,p.first.second+3+p.second})==0 && vis.count({p.first.first+1,p.first.second+1+p.second})==0
                                    && bis[{{p.first.first+1,p.first.second+1},p.second+2}]==0)
                                    {q.push({{p.first.first+1,p.first.second+1},p.second+2});bis[{{p.first.first+1,p.first.second+1},p.second+2}]=1;}

                                  //forward and up
                                 if(p.first.first-1>=0)
                                if(p.first.second<m+3 && vis.count({p.first.first-1,p.first.second+3+p.second})==0 && vis.count({p.first.first-1,p.first.second+1+p.second})==0
                                    && bis[{{p.first.first-1,p.first.second+1},p.second+2}]==0)
                                    {q.push({{p.first.first-1,p.first.second+1},p.second+2});bis[{{p.first.first-1,p.first.second+1},p.second+2}]=1;}
                                  }
                                 // if(cnt++>100000){cout<<"fucked"<<'\n';break;}

                            }

                            if(flag)cout<<"NO\n";

                        }

    return 0;}


/*
▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
TAYA
ATAY
YATA
AYAT
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <cassert>
#include <iomanip>
#include <random>

using namespace std;

#define ll long long
#define ld double
#define null NULL
#define prev prev228
#define index index228
#define left left228
#define right right228
#define hash hash228
#define y1 y1228
#define firn(i, n) for (int i = 0; i < (int)n; ++i)
#define forn(i, n) for (int i = 1; i <= (int)n; ++i)

template<typename T> void uin(T &a, T b) {
    if (b < a) a = b;
}

template<typename T> void uax(T &a, T b) {
    if (b > a) a = b;
}

const int maxn = 111, INF = 1e9 + 228;

int n, k;

char a[4][maxn * 2];

int d[4][maxn];

void solve() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> k;
	int sx = 0, sy = 0;
	forn(i, 3) {
		forn(j, n) {
			cin >> a[i][j];
			if (a[i][j] == 's') {
				sx = i;
				sy = j;
			}
		}
	}
	for (int i = 1; i <= 3; ++i) {
		for (int j = 1; j <= n + 5; ++j) d[i][j] = INF;
	}
	for (int i = 1; i <= 3; ++i) {
		for (int j = n + 1; j <= 2 * n; ++j) {
			a[i][j] = '.';
		}
	}
	d[sx][sy] = 0;
	vector< pair<int, int> > q;
	q.push_back({sx, sy});
	for (int i = 0; i < (int)q.size(); ++i) {
		pair<int, int> p = q[i];
		int x = p.first, y = p.second;
		for (int dx = -1; dx <= 1; ++dx) {
			int nx = x + dx;
			int ny = y + 3;
			if (1 <= nx && nx <= 3 && ny <= 200 && (a[x][y]=='.'||a[x][y]=='s') && a[x][y + 1] == '.' && a[nx][y + 1] == '.'&&a[nx][y+2]=='.' && a[nx][ny]=='.') {
				if (d[x][y] + 1 < d[nx][ny]) {
					d[nx][ny] = d[x][y] + 1;
					q.push_back({nx, ny});
				}
			}
		}
	}
	bool ok = 0;
	for (int i = 1; i <= 3; ++i) {
		if (d[i][150] != INF || d[i][151] != INF || d[i][152] != INF || d[i][153] != INF) ok = 1;
	}
	if (ok) cout << "YES\n";
	else cout << "NO\n";
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	// freopen(".in", "r", stdin);
	// freopen(".out", "w", stdout);
	int t;
	cin >> t;
	forn(iter, t) solve();
	return 0;
} //


/*
▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
TAYA
ATAY
YATA
AYAT
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <cassert>
#include <iomanip>
#include <random>

using namespace std;

#define ll long long
#define ld double
#define null NULL
#define prev prev228
#define index index228
#define left left228
#define right right228
#define hash hash228
#define y1 y1228
#define firn(i, n) for (int i = 0; i < (int)n; ++i)
#define forn(i, n) for (int i = 1; i <= (int)n; ++i)

template<typename T> void uin(T &a, T b) {
    if (b < a) a = b;
}

template<typename T> void uax(T &a, T b) {
    if (b > a) a = b;
}

const int maxn = 228, INF = 1e9 + 228;

int n, k;

char a[4][maxn];

int d[4][maxn];

void solve() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> k;
	int sx = 0, sy = 0;
	forn(i, 3) {
		forn(j, n) {
			cin >> a[i][j];
			if (a[i][j] == 's') {
				sx = i;
				sy = j;
			}
		}
	}
	for (int i = 1; i <= 3; ++i) {
		for (int j = 1; j < 228; ++j) d[i][j] = INF;
	}
	for (int i = 1; i <= 3; ++i) {
		for (int j = n + 1; j < 228; ++j) {
			a[i][j] = '.';
		}
	}
	d[sx][sy] = 0;
	vector< pair<int, int> > q;
	q.push_back({sx, sy});
	for (int i = 0; i < (int)q.size(); ++i) {
		pair<int, int> p = q[i];
		int x = p.first, y = p.second;
		for (int dx = -1; dx <= 1; ++dx) {
			int nx = x + dx;
			int ny = y + 3;
			if (1 <= nx && nx <= 3 && ny <= 200 && (a[x][y]=='.'||a[x][y]=='s') && a[x][y + 1] == '.' && a[nx][y + 1] == '.'&&a[nx][y+2]=='.' && a[nx][ny]=='.') {
				if (d[x][y] + 1 < d[nx][ny]) {
					d[nx][ny] = d[x][y] + 1;
					q.push_back({nx, ny});
				}
			}
		}
	}
	bool ok = 0;
	for (int i = 1; i <= 3; ++i) {
		if (d[i][150] != INF || d[i][151] != INF || d[i][152] != INF || d[i][153] != INF) ok = 1;
	}
	if (ok) cout << "YES\n";
	else cout << "NO\n";
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	// freopen(".in", "r", stdin);
	// freopen(".out", "w", stdout);
	int t;
	cin >> t;
	forn(iter, t) solve();
	return 0;
} //


/*
▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
TAYA
ATAY
YATA
AYAT
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <cassert>
#include <iomanip>
#include <random>

using namespace std;

#define ll long long
#define ld double
#define null NULL
#define prev prev228
#define index index228
#define left left228
#define right right228
#define hash hash228
#define y1 y1228
#define firn(i, n) for (int i = 0; i < (int)n; ++i)
#define forn(i, n) for (int i = 1; i <= (int)n; ++i)

template<typename T> void uin(T &a, T b) {
    if (b < a) a = b;
}

template<typename T> void uax(T &a, T b) {
    if (b > a) a = b;
}

const int maxn = 111, INF = 1e9 + 228;

int n, k;

char a[4][maxn];

int d[4][maxn];

void solve() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> k;
	int sx = 0, sy = 0;
	forn(i, 3) {
		forn(j, n) {
			cin >> a[i][j];
			if (a[i][j] == 's') {
				sx = i;
				sy = j;
			}
		}
	}
	for (int i = 1; i <= 3; ++i) {
		for (int j = 1; j <= n + 5; ++j) d[i][j] = INF;
	}
	for (int i = 1; i <= 3; ++i) {
		a[i][n + 1] = a[i][n + 2] = a[i][n + 3] = a[i][n + 4] = a[i][n + 5] = '.';
	}
	d[sx][sy] = 0;
	vector< pair<int, int> > q;
	q.push_back({sx, sy});
	for (int i = 0; i < (int)q.size(); ++i) {
		pair<int, int> p = q[i];
		int x = p.first, y = p.second;
		for (int dx = -1; dx <= 1; ++dx) {
			int nx = x + dx;
			int ny = y + 3;
			if (1 <= nx && nx <= 3 && (a[x][y]=='.'||a[x][y]=='s') && a[x][y + 1] == '.' && a[nx][y + 1] == '.'&&a[nx][y+2]=='.' && a[nx][ny]=='.') {
				if (d[x][y] + 1 < d[nx][ny]) {
					d[nx][ny] = d[x][y] + 1;
					q.push_back({nx, ny});
				}
			}
		}
	}
	bool ok = 0;
	for (int i = 1; i <= 3; ++i) {
		if (d[i][n] != INF && a[i][n] == '.') ok = 1;
		if (d[i][n + 1] != INF || d[i][n + 1] != INF) ok = 1;
	}
	if (ok) cout << "YES\n";
	else cout << "NO\n";
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	// freopen(".in", "r", stdin);
	// freopen(".out", "w", stdout);
	int t;
	cin >> t;
	forn(iter, t) solve();
	return 0;
} //


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<int,int>
#define mp make_pair
#define pb push_back

int main()
{
	ios_base::sync_with_stdio(0);

	int tc2,tc;
	cin>>tc2;
	tc=tc2;
	while(tc--)
	{
		int n,k;
		cin>>n>>k;
		char arr[3][n];
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<n;j++) cin>>arr[i][j];
		}

		if(tc2==4&&tc<=0)
		{
			cout<<n<<" "<<k<<endl;
			for(int i=0;i<3;i++)
			{
				for(int j=0;j<n;j++) cout<<arr[i][j]<<" ";cout<<endl;
			}
		}
		int s=0;
		if(arr[1][0]=='s') s=1;
		if(arr[2][0]=='s') s=2;
		queue<ii>q;
		if(arr[s][1]!='.') goto no;
		q.push(mp(1,s));
		if(s!=0 && arr[s-1][1]=='.') q.push(mp(1,s-1));
		if(s!=2 && arr[s+1][1]=='.') q.push(mp(1,s+1));
		while(!q.empty())
		{
			ii u=q.front();
			s=u.second;
//			cout<<u.second<<" "<<u.first<<endl;
			q.pop();
			if(u.first>=n-1) goto yes;
			int bo=0;
			for(int i=1;i<=3;i++)
			{
				if(i+u.first==n)
				{
					if(bo==0) goto yes;
					else {break;}
				}
				if(arr[s][i+u.first]!='.'&&arr[s][i+u.first]!='1') bo=1;
			}
			if(bo==0)
			{
				q.push(mp(u.first+3,s)),arr[s][u.first+3]=1;
				if(s!=0 && arr[s-1][u.first+3]=='.') q.push(mp(u.first+3,s-1)),arr[s-1][u.first+3]=1;
				if(s!=2 && arr[s+1][u.first+3]=='.') q.push(mp(u.first+3,s+1)),arr[s+1][u.first+3]=1;
			}
		}
		goto no;
		yes:
			cout<<"YES\n";
			continue;
		no:
			cout<<"NO\n";
	}
}

//think different for one moment, clearly, dont rush to code......


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<int,int>
#define mp make_pair
#define pb push_back

int main()
{
	ios_base::sync_with_stdio(0);

	int tc2,tc;
	cin>>tc2;
	tc=tc2;
	while(tc--)
	{
		int n,k;
		cin>>n>>k;
		char arr[3][n];
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<n;j++) cin>>arr[i][j];
		}

		if(tc2==4&&tc<=1)
		{
			cout<<n<<" "<<k<<endl;
			for(int i=0;i<3;i++)
			{
				for(int j=0;j<n;j++) cout<<arr[i][j]<<" ";cout<<endl;
			}
		}
		int s=0;
		if(arr[1][0]=='s') s=1;
		if(arr[2][0]=='s') s=2;
		queue<ii>q;
		if(arr[s][1]!='.') goto no;
		q.push(mp(1,s));
		if(s!=0 && arr[s-1][1]=='.') q.push(mp(1,s-1));
		if(s!=2 && arr[s+1][1]=='.') q.push(mp(1,s+1));
		while(!q.empty())
		{
			ii u=q.front();
			s=u.second;
//			cout<<u.second<<" "<<u.first<<endl;
			q.pop();
			if(u.first>=n-1) goto yes;
			int bo=0;
			for(int i=1;i<=3;i++)
			{
				if(i+u.first==n)
				{
					if(bo==0) goto yes;
					else {break;}
				}
				if(arr[s][i+u.first]!='.'&&arr[s][i+u.first]!='1') bo=1;
			}
			if(bo==0)
			{
				q.push(mp(u.first+3,s)),arr[s][u.first+3]=1;
				if(s!=0 && arr[s-1][u.first+3]=='.') q.push(mp(u.first+3,s-1)),arr[s-1][u.first+3]=1;
				if(s!=2 && arr[s+1][u.first+3]=='.') q.push(mp(u.first+3,s+1)),arr[s+1][u.first+3]=1;
			}
		}
		goto no;
		yes:
			cout<<"YES\n";
			continue;
		no:
			cout<<"NO\n";
	}
}

//think different for one moment, clearly, dont rush to code......


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<int,int>
#define mp make_pair
#define pb push_back

int main()
{
	ios_base::sync_with_stdio(0);

	int tc2,tc;
	cin>>tc2;
	tc=tc2;
	while(tc--)
	{
		int n,k;
		cin>>n>>k;
		char arr[3][n];
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<n;j++) cin>>arr[i][j];
		}

		if(tc2==4&&tc<=0)
		{
			cout<<n<<" "<<k<<endl;
			for(int i=2;i<3;i++)
			{
				for(int j=0;j<n;j++) cout<<arr[i][j]<<" ";cout<<endl;
			}
		}
		int s=0;
		if(arr[1][0]=='s') s=1;
		if(arr[2][0]=='s') s=2;
		queue<ii>q;
		if(arr[s][1]!='.') goto no;
		q.push(mp(1,s));
		if(s!=0 && arr[s-1][1]=='.') q.push(mp(1,s-1));
		if(s!=2 && arr[s+1][1]=='.') q.push(mp(1,s+1));
		while(!q.empty())
		{
			ii u=q.front();
			s=u.second;
//			cout<<u.second<<" "<<u.first<<endl;
			q.pop();
			if(u.first>=n-1) goto yes;
			int bo=0;
			for(int i=1;i<=3;i++)
			{
				if(i+u.first==n)
				{
					if(bo==0) goto yes;
					else {break;}
				}
				if(arr[s][i+u.first]!='.'&&arr[s][i+u.first]!='1') bo=1;
			}
			if(bo==0)
			{
				q.push(mp(u.first+3,s)),arr[s][u.first+3]=1;
				if(s!=0 && arr[s-1][u.first+3]=='.') q.push(mp(u.first+3,s-1)),arr[s-1][u.first+3]=1;
				if(s!=2 && arr[s+1][u.first+3]=='.') q.push(mp(u.first+3,s+1)),arr[s+1][u.first+3]=1;
			}
		}
		goto no;
		yes:
			cout<<"YES\n";
			continue;
		no:
			cout<<"NO\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<int,int>
#define mp make_pair
#define pb push_back

int main()
{
	ios_base::sync_with_stdio(0);

	int tc2,tc;
	cin>>tc2;
	tc=tc2;
	while(tc--)
	{
		int n,k;
		cin>>n>>k;
		char arr[3][n];
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<n;j++) cin>>arr[i][j];
		}

		if(tc2==4&&tc<=0)
		{
			cout<<n<<" "<<k<<endl;
			for(int i=0;i<3;i++)
			{
				for(int j=2;j<n;j++) cout<<arr[i][j]<<" ";cout<<endl;
			}
		}
		int s=0;
		if(arr[1][0]=='s') s=1;
		if(arr[2][0]=='s') s=2;
		queue<ii>q;
		if(arr[s][1]!='.') goto no;
		q.push(mp(1,s));
		if(s!=0 && arr[s-1][1]=='.') q.push(mp(1,s-1));
		if(s!=2 && arr[s+1][1]=='.') q.push(mp(1,s+1));
		while(!q.empty())
		{
			ii u=q.front();
			s=u.second;
//			cout<<u.second<<" "<<u.first<<endl;
			q.pop();
			if(u.first>=n-1) goto yes;
			int bo=0;
			for(int i=1;i<=3;i++)
			{
				if(i+u.first==n)
				{
					if(bo==0) goto yes;
					else {break;}
				}
				if(arr[s][i+u.first]!='.'&&arr[s][i+u.first]!='1') bo=1;
			}
			if(bo==0)
			{
				q.push(mp(u.first+3,s)),arr[s][u.first+3]=1;
				if(s!=0 && arr[s-1][u.first+3]=='.') q.push(mp(u.first+3,s-1)),arr[s-1][u.first+3]=1;
				if(s!=2 && arr[s+1][u.first+3]=='.') q.push(mp(u.first+3,s+1)),arr[s+1][u.first+3]=1;
			}
		}
		goto no;
		yes:
			cout<<"YES\n";
			continue;
		no:
			cout<<"NO\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<int,int>
#define mp make_pair
#define pb push_back

int main()
{
	ios_base::sync_with_stdio(0);

	int tc;
	cin>>tc;
	while(tc--)
	{
		int n,k;
		cin>>n>>k;
		char arr[3][n];
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<n;j++) cin>>arr[i][j];
		}
		int s=0;
		if(arr[1][0]=='s') s=1;
		if(arr[2][0]=='s') s=2;
		queue<ii>q;
		if(arr[s][1]!='.') goto no;
		q.push(mp(1,s));
		if(s!=0 && arr[s-1][1]=='.') q.push(mp(1,s-1));
		if(s!=2 && arr[s+1][1]=='.') q.push(mp(1,s+1));
		while(!q.empty())
		{
			ii u=q.front();
//			cout<<u.second<<" "<<u.first<<endl;
			q.pop();
			if(u.first>=n-1) goto yes;
			int bo=0;
			for(int i=1;i<=3;i++)
			{
				if(i+u.first==n)
				{
					if(bo==0) goto yes;
					else {break;}
				}
				if(arr[u.second][i+u.first]!='.') bo=1;
			}
			if(bo==0)
			{
				s=u.second;
				if(arr[s][u.first+3]=='.') q.push(mp(u.first+3,s));
				if(s!=0 && arr[s-1][u.first+3]=='.') q.push(mp(u.first+3,s-1)),arr[s-1][u.first+3]=1;
				if(s!=2 && arr[s+1][u.first+3]=='.') q.push(mp(u.first+3,s+1)),arr[s+1][u.first+3]=1;
			}
		}
		goto no;
		yes:
			cout<<"YES\n";
			continue;
		no:
			cout<<"NO\n";
	}
}

//think different for one moment, clearly, dont rush to code......


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<int,int>
#define mp make_pair
#define pb push_back

int main()
{
	ios_base::sync_with_stdio(0);

	int tc;
	cin>>tc;
	while(tc--)
	{
		int n,k;
		cin>>n>>k;
		char arr[3][n+10];
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<n;j++) cin>>arr[i][j];
			for(int j=n;j<n+8;j++) arr[i][j]='.';
		}
		int s=0;
		if(arr[1][0]=='s') s=1;
		if(arr[2][0]=='s') s=2;
		queue<ii>q;
		if(arr[s][1]!='.') goto no;
		q.push(mp(1,s));
		if(s!=0 && arr[s-1][1]=='.') q.push(mp(1,s-1));
		if(s!=2 && arr[s+1][1]=='.') q.push(mp(1,s+1));
		while(!q.empty())
		{
			ii u=q.front();
			s=u.second;
			q.pop();
			if(u.first>=n) goto yes;
			int bo=0;
			for(int i=1;i<=3;i++)
			{
				if(arr[s][i+u.first]!='.'&&arr[s][i+u.first]!='1') bo=1;
			}
			if(bo==0)
			{
				if(arr[s][u.first+3]=='.')q.push(mp(u.first+3,s)),arr[s][u.first+3]=1;
				if(s!=0 && arr[s-1][u.first+3]=='.') q.push(mp(u.first+3,s-1)),arr[s-1][u.first+3]='1';
				if(s!=2 && arr[s+1][u.first+3]=='.') q.push(mp(u.first+3,s+1)),arr[s+1][u.first+3]='1';
			}
		}
		goto no;
		yes:
			cout<<"YES\n";
			continue;
		no:
			cout<<"NO\n";
	}
}

//think different for one moment, clearly, dont rush to code......


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long int
#define pb push_back
#define mp make_pair
#define ip pair<int, int>
#define F first
#define S second
#define fori(l, n) for(int i = l; i < n; i++)
#define forj(k, m) for(int j = k; j < m; j++)
#define revi(h) for(int i = h; i >= 0; i--)
#define all(v) v.begin(), v.end()
#define PI 3.14159265358
#define debug(x) cout<<"DEBUGGING --- "<<x<<endl;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define input_from_file  freopen("input.txt", "r", stdin);
#define output_to_file freopen("output.txt", "w", stdout);
vector<vector<char>>G(4);
int N;
// void change(){
//     fori(0, 3){
//         G[i].erase(G[i].begin());
//         G[i].erase(G[i].begin());
//         G[i].push_back('.');
//         G[i].push_back('.');
//     }
// }
bool isValid(int r, int c){
    return (r >= 0 && r < 3 && c >= 0 && c < N + 2 && G[r][c] == '.');
}
signed main(){
    fastio;
// 	input_from_file;
// 	output_to_file;
    int t;
    cin>>t;
    while(t--){
        int n, k;
        cin>>n>>k; N = n;
        int x0, y0;
        fori(0, 3){
            G[i].clear();
            forj(0, n){
                char c; cin>>c; G[i].pb(c);
                if(c == 's') G[i][j] = '.', x0 = i, y0 = j;
            }
            G[i].pb('.'); G[i].pb('.');
        }
        vector<vector<bool>>vis(3, vector<bool>(n, false));
        queue<ip>q;
        q.push({x0, y0});
        bool flag = false;
        while(!q.empty()){
            auto t = q.front();
            q.pop();
            int x1 = t.F, y1 = t.S;
            if(vis[x1][y1]) continue;
            vis[x1][y1] = true;
            //cout<<x1<<" "<<y1<<endl;
            if(y1 >= n - 1 && y1 <= n + 1) {flag = true; break;}
            //if(!isValid(x1, y1)) continue;
            // fori(0, 3){
            //     forj(0, n) cout<<G[i][j]<<" ";
            //     cout<<endl;
            // }
            fori(-1, 2){
                if(!isValid(x1, y1 + 1) || vis[x1][y1 + 1]) continue;
                if(!isValid(x1 + i, y1 + 1) || vis[x1 + i][y1 + 1]) continue;
                if(!isValid(x1 + i, y1 + 2) || vis[x1 + i][y1 + 2]) continue;
                if(!isValid(x1 + i, y1 + 3) || vis[x1 + i][y1 + 3]) continue;
                q.push({x1 + i, y1 + 3});
            }
        }
        if(flag) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long int
#define pb push_back
#define mp make_pair
#define ip pair<int, int>
#define F first
#define S second
#define fori(l, n) for(int i = l; i < n; i++)
#define forj(k, m) for(int j = k; j < m; j++)
#define revi(h) for(int i = h; i >= 0; i--)
#define all(v) v.begin(), v.end()
#define PI 3.14159265358
#define debug(x) cout<<"DEBUGGING --- "<<x<<endl;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define input_from_file  freopen("input.txt", "r", stdin);
#define output_to_file freopen("output.txt", "w", stdout);
vector<vector<char>>G(4);
int N;
// void change(){
//     fori(0, 3){
//         G[i].erase(G[i].begin());
//         G[i].erase(G[i].begin());
//         G[i].push_back('.');
//         G[i].push_back('.');
//     }
// }
bool isValid(int r, int c){
    return (r >= 0 && r < 3 && c >= 0 && c < N && G[r][c] == '.');
}
signed main(){
    fastio;
// 	input_from_file;
// 	output_to_file;
    int t;
    cin>>t;
    while(t--){
        int n, k;
        cin>>n>>k; N = n;
        int x0, y0;
        fori(0, 3){
            G[i].clear();
            forj(0, n){
                char c; cin>>c; G[i].pb(c);
                if(c == 's') G[i][j] = '.', x0 = i, y0 = j;
            }}
        vector<vector<bool>>vis(3, vector<bool>(n, false));
        queue<ip>q;
        q.push({x0, y0});
        bool flag = false;
        while(!q.empty()){
            auto t = q.front();
            q.pop();
            int x1 = t.F, y1 = t.S;
            if(vis[x1][y1]) continue;
            vis[x1][y1] = true;
            if(y1 == n - 1) {flag = true; break;}
            //if(!isValid(x1, y1)) continue;
            //cout<<x1<<" "<<y1<<endl;
            // fori(0, 3){
            //     forj(0, n) cout<<G[i][j]<<" ";
            //     cout<<endl;
            // }
            fori(-1, 2){
                if(!isValid(x1, y1 + 1) || vis[x1][y1 + 1]) continue;
                if(!isValid(x1 + i, y1 + 1) || vis[x1 + i][y1 + 1]) continue;
                if(!isValid(x1 + i, y1 + 2) || vis[x1 + i][y1 + 2]) continue;
                if(!isValid(x1 + i, y1 + 3) || vis[x1 + i][y1 + 3]) continue;
                q.push({x1 + i, y1 + 3});
            }
        }
        if(flag) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long int
#define pb push_back
#define mp make_pair
#define ip pair<int, int>
#define F first
#define S second
#define fori(l, n) for(int i = l; i < n; i++)
#define forj(k, m) for(int j = k; j < m; j++)
#define revi(h) for(int i = h; i >= 0; i--)
#define all(v) v.begin(), v.end()
#define PI 3.14159265358
#define debug(x) cout<<"DEBUGGING --- "<<x<<endl;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define input_from_file  freopen("input.txt", "r", stdin);
#define output_to_file freopen("output.txt", "w", stdout);
vector<vector<char>>G(4);
int N;
// void change(){
//     fori(0, 3){
//         G[i].erase(G[i].begin());
//         G[i].erase(G[i].begin());
//         G[i].push_back('.');
//         G[i].push_back('.');
//     }
// }
bool isValid(int r, int c){
    return (r >= 0 && r < 3 && c >= 0 && c < N + 4 && G[r][c] == '.');
}
signed main(){
    fastio;
// 	input_from_file;
// 	output_to_file;
    int t;
    cin>>t;
    while(t--){
        int n, k;
        cin>>n>>k; N = n;
        int x0, y0;
        fori(0, 3){
            G[i].clear();
            forj(0, n){
                char c; cin>>c; G[i].pb(c);
                if(c == 's') G[i][j] = '.', x0 = i, y0 = j;
            }
            G[i].pb('.'); G[i].pb('.'); G[i].pb('.'); G[i].pb('.');
        }
        vector<vector<bool>>vis(3, vector<bool>(n + 5, false));
        queue<ip>q;
        q.push({x0, y0});
        bool flag = false;
        while(!q.empty()){
            auto t = q.front();
            q.pop();
            int x1 = t.F, y1 = t.S;
            if(vis[x1][y1]) continue;
            vis[x1][y1] = true;
            //cout<<x1<<" "<<y1<<endl;
            if(y1 >= n - 1 && y1 <= n + 3) {flag = true; break;}
            //if(!isValid(x1, y1)) continue;
            // fori(0, 3){
            //     forj(0, n) cout<<G[i][j]<<" ";
            //     cout<<endl;
            // }
            fori(-1, 2){
                if(!isValid(x1, y1 + 1) || vis[x1][y1 + 1]) continue;
                if(!isValid(x1 + i, y1 + 1) || vis[x1 + i][y1 + 1]) continue;
                if(!isValid(x1 + i, y1 + 2) || vis[x1 + i][y1 + 2]) continue;
                if(!isValid(x1 + i, y1 + 3) || vis[x1 + i][y1 + 3]) continue;
                q.push({x1 + i, y1 + 3});
            }
        }
        if(flag) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long int
#define pb push_back
#define mp make_pair
#define ip pair<int, int>
#define F first
#define S second
#define fori(l, n) for(int i = l; i < n; i++)
#define forj(k, m) for(int j = k; j < m; j++)
#define revi(h) for(int i = h; i >= 0; i--)
#define all(v) v.begin(), v.end()
#define PI 3.14159265358
#define debug(x) cout<<"DEBUGGING --- "<<x<<endl;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define input_from_file  freopen("input.txt", "r", stdin);
#define output_to_file freopen("output.txt", "w", stdout);
vector<vector<char>>G(4);
int N;
// void change(){
//     fori(0, 3){
//         G[i].erase(G[i].begin());
//         G[i].erase(G[i].begin());
//         G[i].push_back('.');
//         G[i].push_back('.');
//     }
// }
bool isValid(int r, int c){
    return (r >= 0 && r < 3 && c >= 0 && c < N + 4 && G[r][c] == '.');
}
signed main(){
    fastio;
// 	input_from_file;
// 	output_to_file;
    int t;
    cin>>t;
    while(t--){
        int n, k;
        cin>>n>>k; N = n;
        int x0, y0;
        fori(0, 3){
            G[i].clear();
            forj(0, n){
                char c; cin>>c; G[i].pb(c);
                if(c == 's') G[i][j] = '.', x0 = i, y0 = j;
            }
            G[i].pb('.'); G[i].pb('.'); G[i].pb('.'); G[i].pb('.');
        }
        vector<vector<bool>>vis(3, vector<bool>(n, false));
        queue<ip>q;
        q.push({x0, y0});
        bool flag = false;
        while(!q.empty()){
            auto t = q.front();
            q.pop();
            int x1 = t.F, y1 = t.S;
            if(vis[x1][y1]) continue;
            vis[x1][y1] = true;
            //cout<<x1<<" "<<y1<<endl;
            if(y1 >= n - 1 && y1 <= n + 3) {flag = true; break;}
            //if(!isValid(x1, y1)) continue;
            // fori(0, 3){
            //     forj(0, n) cout<<G[i][j]<<" ";
            //     cout<<endl;
            // }
            fori(-1, 2){
                if(!isValid(x1, y1 + 1) || vis[x1][y1 + 1]) continue;
                if(!isValid(x1 + i, y1 + 1) || vis[x1 + i][y1 + 1]) continue;
                if(!isValid(x1 + i, y1 + 2) || vis[x1 + i][y1 + 2]) continue;
                if(!isValid(x1 + i, y1 + 3) || vis[x1 + i][y1 + 3]) continue;
                q.push({x1 + i, y1 + 3});
            }
        }
        if(flag) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long int
#define pb push_back
#define mp make_pair
#define ip pair<int, int>
#define F first
#define S second
#define fori(l, n) for(int i = l; i < n; i++)
#define forj(k, m) for(int j = k; j < m; j++)
#define revi(h) for(int i = h; i >= 0; i--)
#define all(v) v.begin(), v.end()
#define PI 3.14159265358
#define debug(x) cout<<"DEBUGGING --- "<<x<<endl;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define input_from_file  freopen("input.txt", "r", stdin);
#define output_to_file freopen("output.txt", "w", stdout);
vector<vector<char>>G(4);
int N;
void change(){
    fori(0, 3){
        G[i].erase(G[i].begin());
        G[i].erase(G[i].begin());
        G[i].push_back('.');
        G[i].push_back('.');
    }
}
bool isValid(int r, int c){
    return (r >= 0 && r < 3 && c >= 0 && c < N && G[r][c] == '.');
}
signed main(){
    fastio;
// 	input_from_file;
// 	output_to_file;
    int t;
    cin>>t;
    while(t--){
        int n, k;
        cin>>n>>k; N = n;
        int x0, y0;
        fori(0, 3){
            G[i].clear();
            forj(0, n){
                char c; cin>>c; G[i].pb(c);
                if(c == 's') G[i][j] = '.', x0 = i, y0 = j;
            }}
        vector<vector<bool>>vis(3, vector<bool>(n, false));
        queue<ip>q;
        q.push({x0, y0});
        bool flag = false;
        while(!q.empty()){
            auto t = q.front();
            q.pop();
            int x1 = t.F, y1 = t.S;
            if(vis[x1][y1]) continue;
            vis[x1][y1] = true;
            if(!isValid(x1, y1)) continue;
            //cout<<x1<<" "<<y1<<endl;
            // fori(0, 3){
            //     forj(0, n) cout<<G[i][j]<<" ";
            //     cout<<endl;
            // }
            if(y1 == n - 1) {flag = true; break;}
            if(isValid(x1, y1 + 1) && !vis[x1][y1 + 1]) q.push({x1, y1 + 1});
            else {flag = false; break;}
            if(isValid(x1 + 1, y1 + 1) && !vis[x1 + 1][y1 + 1]) q.push({x1 + 1, y1 + 1});
            if(isValid(x1 - 1, y1 + 1) && !vis[x1 - 1][y1 + 1]) q.push({x1 - 1, y1 + 1});
            change();
        }
        if(flag) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long int
#define pb push_back
#define mp make_pair
#define ip pair<int, int>
#define F first
#define S second
#define fori(l, n) for(int i = l; i < n; i++)
#define forj(k, m) for(int j = k; j < m; j++)
#define revi(h) for(int i = h; i >= 0; i--)
#define all(v) v.begin(), v.end()
#define PI 3.14159265358
#define debug(x) cout<<"DEBUGGING --- "<<x<<endl;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define input_from_file  freopen("input.txt", "r", stdin);
#define output_to_file freopen("output.txt", "w", stdout);
vector<vector<char>>G(4);
int N;
void change(){
    fori(0, 3){
        G[i].erase(G[i].begin());
        G[i].erase(G[i].begin());
        G[i].push_back('.');
        G[i].push_back('.');
    }
}
bool isValid(int r, int c){
    return (r >= 0 && r < 3 && c >= 0 && c < N && G[r][c] == '.');
}
signed main(){
    fastio;
// 	input_from_file;
// 	output_to_file;
    int t;
    cin>>t;
    while(t--){
        int n, k;
        cin>>n>>k; N = n;
        int x0, y0;
        fori(0, 3){
            G[i].clear();
            forj(0, n){
                char c; cin>>c; G[i].pb(c);
                if(c == 's') G[i][j] = '.', x0 = i, y0 = j;
            }}
        queue<ip>q;
        q.push({x0, y0});
        bool flag = false;
        while(!q.empty()){
            auto t = q.front();
            q.pop();
            int x1 = t.F, y1 = t.S;
            if(!isValid(x1, y1)) continue;
            //cout<<x1<<" "<<y1<<endl;
            // fori(0, 3){
            //     forj(0, n) cout<<G[i][j]<<" ";
            //     cout<<endl;
            // }
            if(y1 == n - 1) {flag = true; break;}
            if(isValid(x1, y1 + 1)) q.push({x1, y1 + 1});
            else {flag = false; break;}
            if(isValid(x1 + 1, y1 + 1)) q.push({x1 + 1, y1 + 1});
            if(isValid(x1 - 1, y1 + 1)) q.push({x1 - 1, y1 + 1});
            change();
        }
        if(flag) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}