#include <bits/stdc++.h>
using namespace std;
const long long N = 111;
long long te, n, m, x, a[N], l, r, mid, k;
string s;
long long f(long long x) {
  long long l = 0, r = n, mid;
  while (l < r) {
    mid = (l + r + 1) / 2;
    if (a[mid] <= x)
      l = mid;
    else
      r = mid - 1;
  }
  return x + 1 - l;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> te;
  for (; te--;) {
    cin >> n >> m;
    for (long long i = 1; i <= n; i++) {
      cin >> s;
      x = 0;
      for (long long j = 0; j < m; j++) x = x * 2 + s[j] - 48;
      a[i] = x;
    }
    sort(a + 1, a + n + 1);
    k = ((1LL << m) - n + 1) / 2;
    l = 0, r = (1LL << m) - 1;
    while (l < r) {
      mid = (l + r) / 2;
      if (f(mid) >= k)
        r = mid;
      else
        l = mid + 1;
    }
    for (long long i = m - 1; i >= 0; i--) cout << ((l >> i) & 1);
    cout << endl;
  }
}
