#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define endl ("\n")
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define vi vector<lli>
#define ff first
#define ss second
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repr(i, a, b) for (int i = a; i > b; i--)
int main() {
    fast
    lli t, n;
    t = 1;
    // cin>>t;
    while (t--) {
        cin>>n;
        n = pow(2, n);
        lli a[n], mx1 = 0, mx2 = 0, p, q;
        rep (i, 0, n) cin>>a[i];
        rep (i, 0, n/2) {
        	if (a[i] > mx1) {
        		mx1 = a[i];
        		p = i;
        	}
        }
        rep (i, n/2, n) {
        	if (a[i] > mx2) {
        		mx2 = a[i];
        		q = i;
        	}
        }
        if (mx1 > mx2) cout<<q + 1;
        else cout<<p + 1;
    }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
using pss = pair<string, string>;
using pll = pair<ll, ll>;
using pls = pair<ll,string>;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define endl '\n';
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const long long mod = 1 * 1e18 + 7;
int main()
{
    IO;
    ll i=0, j=0, m=0, n=0, k=0, t=0;
    cin>>t;
    while(t--)
    {
        cin>>n;
        string s[3];
        for(i=0;i<3;i++)
        cin>>s[i];
        string ans="";
        ans.push_back('1');
        for(i=0;i<n;i++)
        ans.push_back('0');
        for(i=0;i<n;i++)
        ans.push_back('1');
        cout<<ans<<endl;
    }
    return 0;
}