#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 2;
int t, n, m;
int ar[N];
long long toDec(string s) {
  long long ret = 0;
  for (long long i = s.length() - 1, j = 1; i >= 0; i--, j *= 2) {
    ret += j * (s[i] == '1');
  }
  return ret;
}
string toBin(long long x) {
  string ret;
  while (x > 0ll) {
    ret = char(x % 2 + '0') + ret;
    x /= 2;
  }
  return ret;
}
string output(string s) {
  while (s.length() < m) {
    s = '0' + s;
  }
  return s;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> m;
    long long len = (1ll) << m;
    long long N = len;
    long long med = (N - 1) / 2;
    map<long long, int> popp;
    for (int i = 1; i <= n; i++) {
      string s;
      cin >> s;
      long long x = toDec(s);
      popp[x] = 1;
      long long tmp = med;
      if (x == med) {
        if (len % 2 == 0) {
          tmp++;
          for (long long j = med + 1; popp[j] == 1 && j <= N; j++) tmp++;
        } else {
          tmp--;
          for (long long j = med - 1; popp[j] == 1 && j >= 0; j--) tmp--;
        }
      } else if (x < med) {
        if (len % 2 == 0) {
          tmp++;
          for (long long j = med + 1; popp[j] == 1 && j <= N; j++) tmp++;
        }
      } else {
        if (len % 2 == 1) {
          tmp--;
          for (long long j = med - 1; popp[j] == 1 && j >= 0; j--) tmp--;
        }
      }
      med = tmp;
      len--;
    }
    cout << output(toBin(med)) << '\n';
  }
  return 0;
}
