#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<long long> a;
long long smaller_del(long long x) {
  long long l = 0, r = n - 1, sol = 0;
  while (l <= r) {
    long long m = (l + r) / 2;
    if (a[m] <= x) {
      sol = m + 1;
      l = m + 1;
    } else {
      r = m - 1;
    }
  }
  return sol;
}
long long smaller_not_del(long long x) { return x + 1 - smaller_del(x); }
void pen(long long x) {
  for (long long j = m - 1; j >= 0; j--) {
    if ((1LL << j) & x) {
      cout << 1;
    } else {
      cout << 0;
    }
  }
}
int tc = 0;
void st() {
  tc++;
  cin >> n >> m;
  a.clear();
  a.resize(n);
  for (long long i = 0; i < n; i++) {
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    long long foo = 0;
    for (long long j = 0; j < m; j++) {
      if (s[j] == '1') {
        foo ^= (1LL << j);
      }
    }
    a[i] = foo;
  }
  sort(a.begin(), a.end());
  long long k = (1LL << m) - n;
  k = (k - 1) / 2 + 1;
  long long l = 0, r = (1LL << m) - 1, sol = -1;
  while (l <= r) {
    long long md = (l + r) / 2;
    if (smaller_not_del(md) < k) {
      sol = md;
      l = md + 1;
    } else {
      r = md - 1;
    }
  }
  pen(sol + 1);
  cout << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    st();
  }
  return 0;
}
