#include <bits/stdc++.h>
using namespace std;
inline int qr() {
  int f = 0, fu = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') fu = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    f = (f << 3) + (f << 1) + c - 48;
    c = getchar();
  }
  return f * fu;
}
int T, n, m;
vector<long long> a;
map<long long, bool> v;
inline long long find() {
  long long x = ((1ll << m) - n + 1) >> 1;
  long long l = 0, r = (1ll << m) - 1;
  while (l < r) {
    long long mid = (l + r + 1) >> 1;
    if (mid - (upper_bound(a.begin(), a.end(), mid) - a.begin()) + 1 > x)
      r = mid - 1;
    else
      l = mid;
  }
  while (v[l]) l--;
  return l;
}
char num[100];
int main() {
  T = qr();
  while (T--) {
    n = qr(), m = qr();
    a.clear(), v.clear();
    for (register int i = 1; i <= n; ++i) {
      scanf("%s", num + 1);
      long long res = 0;
      for (register int j = 0; j <= m - 1; ++j)
        if (num[m - j] == '1') res += (1ll << j);
      a.push_back(res), v[res] = true;
    }
    sort(a.begin(), a.end());
    long long res = find();
    vector<int> ans;
    while (res) ans.push_back(res & 1), res >>= 1;
    for (register int i = 1; i <= m - ans.size(); ++i) putchar('0');
    for (register int i = ans.size() - 1; i >= 0; --i) printf("%d", ans[i]);
    puts("");
  }
  return 0;
}
