#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = (int) 2e5 + 5;
char tmp[maxn];
int n;
string s[3];

bool read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  for (int i = 0; i < 3; ++i) {
    scanf("%s", tmp);
    s[i] = tmp;
  }
  return true;
}

string ans;

void solve() {
  ans = string(n, '0') + string(n, '1') + string(1, '0');
  printf("%s\n", ans.c_str());
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  int t;
  scanf("%d", &t);
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}

#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>
#include <cassert>
#include <random>
#include <chrono>

/* #include <atcoder/all> */
/* using namespace atcoder; */
using namespace std;

void debug_out(){ cout << "\n"; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll MOD = 1000000007;
/* const ll MOD = 998244353; */
const ll INF = 1ll<<60;
const double PI = acos(-1);

struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

string solve(){
  int N;
  cin >> N;

  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;

  int a = s1.size(), b = s2.size(), c = s3.size();

  RREP(i, s1.size()) if(s1[i] == '1'){
    a = i+1; break;
  }
  RREP(i, s2.size()) if(s2[i] == '1'){
    b = i+1; break;
  }
  RREP(i, s2.size()) if(s3[i] == '1'){
    c = i+1; break;
  }

  N = s1.size()/2;
  s1 += s1;
  s2 += s2;
  s3 += s3;

  s1 = s1.substr(a);
  s2 = s2.substr(b);
  s3 = s3.substr(c);

  auto f = [&](string s) -> vector<int> {
    int MAX = 0;
    REP(i, s.size()){
      if(s[i] == '0') MAX++;
    }
    int amari = s.size()-N*2;

    int p = 0, l = 0;
    vector<int> ret(s.size()+1);
    REP(i, s.size()){
      if(s[i] == '1'){
        int r = MAX-l;
        ret[l-amari]++;
        ret[l+1]--;
        p++;
      }else{
        l++;
      }
    }
    REP(i, s.size()) ret[i+1] += ret[i];
    return ret;
  };

  auto v1 = f(s1);
  auto v2 = f(s2);
  auto v3 = f(s3);
  int M = min(v1.size(), min(v2.size(), v3.size()));
  int r = -1;
  REP(i, M){
    if(v1[i] && v2[i] && v3[i]){
      r = i;
      break;
    }
  }

  string ret;
  REP(i, N) ret += '1';
  REP(i, r) ret += '0';
  ret += '1';
  REP(i, N-r) ret += '0';
  return ret;
}

signed main() {
  int T;
  cin >> T;

  REP(i, T){
    cout << solve() << "\n";
  }

  return 0;
}