#include <bits/stdc++.h>
using namespace std;
const long long N = 112, INF = 1e18;
long long t, n, m, a[N];
long long B10(string s) {
  reverse(s.begin(), s.end());
  long long ret = 0;
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] == '1') ret += (1ll << i);
  }
  return ret;
}
string B2(long long a) {
  string ret;
  for (long long i = 0; i < m; i++) {
    if (a & (1ll << i))
      ret += '1';
    else
      ret += '0';
  }
  reverse(ret.begin(), ret.end());
  return ret;
}
long long BS() {
  long long low = 0, high = (1ll << m);
  while (high - low > 1) {
    long long mid = (low + high) >> 1;
    long long v1 = mid - (lower_bound(a, a + n, mid) - a);
    long long v2 = ((1ll << m) - n - 1) / 2;
    if (v1 <= v2)
      low = mid;
    else
      high = mid;
  }
  return low;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> m;
    for (long long i = 0; i < n; i++) {
      string s;
      cin >> s;
      a[i] = B10(s);
    }
    sort(a, a + n);
    cout << B2(BS()) << '\n';
  }
  return 0;
}
