#include <bits/stdc++.h>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt;
    cin >> tt;
    while (tt--) {
        int n;
        cin >> n;
        vector<string> s(3);
        vector<int> a(4);
        for (int i = 0; i < 3; i++) {
            cin >> s[i];
            a[(s[i][0] - '0') * 2 + (s[i].back() - '0')] = 1;
        }
        for (int i = 0; i < 4; i++) {
            if (!a[i]) {
                string ans;
                if (i == 0) {
                    ans += string(n, '0');
                    ans += "1";
                    ans += string(n, '0');
                } else if (i == 1) {
                    ans += string(n, '1');
                    ans += string(n, '0');
                    ans += "1";
                } else if (i == 2) {
                    ans += string(n, '0');
                    ans += string(n, '1');
                    ans += "0";
                } else {
                    ans += string(n, '1');
                    ans += "0";
                    ans += string(n, '1');
                }
                cout << ans << '\n';
                break;
            }
        }
    }
    return 0;
}
#include "bits/stdc++.h"
using namespace std;
#define ll long long

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        string s;
        cin >> s >> s >> s;
        for (int i = 0; i < n; i++)
            cout << "1";
        for (int i = 0; i < n; i++)
            cout << "0";
        cout << 1 << endl;
    }
    return 0;
}