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

int main() {
  long long N;
  cin >> N;
  vector<pair<long long, long long>> A;
  long long ans = 0;
  
  for (long long i=0; i<(pow(2,N)); i++) {
    long long x;
    cin >> x;
    A.push_back( make_pair(i+1, x) );
  }
  
  vector<pair<long long, long long>> B = A;
  
  while (B.size() > 2) {
    vector<pair<long long, long long>> C;
    
    for (long long i=0; i<B.size(); i+=2) {      
      if (B.at(i).second > B.at(i+1).second)
        C.push_back(B.at(i));
      else
        C.push_back(B.at(i+1));
    }
    B = C;
    C.clear();
  }
  
  
  if (B.at(0).second > B.at(1).second)
    cout << B.at(1).first << endl;
  else
    cout << B.at(0).first << endl;
    
  return 0;
}
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
#define rprintf(fmt, begin, end) do { const auto end_rp = (end); auto it_rp = (begin); for (bool sp_rp=0; it_rp!=end_rp; ++it_rp) { if (sp_rp) putchar(' '); else sp_rp = true; printf(fmt, *it_rp); } putchar('\n'); } while(0)

int N;
char buf[200011];

void MAIN() {
    scanf("%d", &N);
    scanf("%s", buf);
    scanf("%s", buf);
    scanf("%s", buf);

    putchar('0');
    REP (i, N) putchar('1');
    REP (i, N) putchar('0');
    puts("");

}

int main() {
    int TC = 1;
    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}

