#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#ifdef APURBA
#include "DEBUG_TEMPLATE.h"
#define HERE cout<<"here - "<<__LINE__<<"\n";
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#else
#define HERE
#define debug(args...)
#endif
const int N = 1e5 +5;
const ll mod = 1e9+7;
typedef pair<int,int> pii;


bool issub(int i, int j , string &s1, string &s2)
{
    if(j==s2.size())
    {
        return 1;
    }
    if(i==s1.size() || j==s2.size())
    {
        return 0;
    }
    if(s1[i]== s2[j])
    {
        return issub(i+1, j+1 , s1, s2);
    }
    else{
        return issub(i+1 , j , s1, s2);
    }
}

void TEST_CASES(int cas)
{
    int n;
    string s1,s2,s3;
    cin>>n>>s1>>s2>>s3;
    s1+=s1;
    s2+=s2;
    s3+=s3;
    debug(s1,s2,s3);
    string ans;
    for(int i=0;i<n;i++)
    {
        ans+="0";
    }
    for(int i=0;i<n;i++)
    {
        ans+="1";
    }
    ans+="0";
    debug(ans);
    if(issub(0,0,s1,ans) && issub(0,0,s2,ans)&&issub(0,0,s3,ans))
    {
        cout<<ans<<"\n";
        return;
    }
    ans.pop_back();
    ans+="1";
    debug(ans);
    if(issub(0,0,s1,ans) && issub(0,0,s2,ans)&&issub(0,0,s3,ans))
    {
        cout<<ans<<"\n";
        return;
    }
    ans.clear();
    for(int i=0;i<n;i++)
    {
        ans+="1";
    }
    for(int i=0;i<n;i++)
    {
        ans+="0";
    }
    ans+="0";
    debug(ans);
    if(issub(0,0,s1,ans) && issub(0,0,s2,ans)&&issub(0,0,s3,ans))
    {
        cout<<ans<<"\n";
        return;
    }
    ans.pop_back();
    ans+="1";
    debug(ans);
    if(issub(0,0,s1,ans) && issub(0,0,s2,ans)&&issub(0,0,s3,ans))
    {
        cout<<ans<<"\n";
        return;
    }
}




/*
*/

int32_t main()
{
#ifndef APURBA
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    //freopen("input.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int t=1,cas=0;
    cin>>t;
    while(t--)
    {
        TEST_CASES(++cas);
    }
    return 0;
}

#include<bits/stdc++.h>
const int N=1e5+100;
using namespace std;
int n;
void run(){
	cin>>n;
	string a,b,c;
	cin>>a>>b>>c;
	for(int i=1;i<=n;i++)cout<<0;
	for(int i=1;i<=n;i++)cout<<1;
	cout<<0<<endl;
}
int main(){
	int T;cin>>T;
	while(T--)
	run();
}