#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 105;
long long a[maxn];
string s;
set<long long> st;
bool in(long long x) { return st.count(x); }
void output(long long x, int m) {
  stack<long long> s;
  for (int i = 0; i < m; i++) {
    s.push(x % 2);
    x /= 2;
  }
  for (int i = 0; i < m; i++) {
    cout << s.top();
    s.pop();
  }
  cout << "\n";
}
void test() {
  int n, m;
  cin >> n >> m;
  st.clear();
  for (int i = 0; i < n; i++) {
    cin >> s;
    long long val = 0;
    reverse(s.begin(), s.end());
    for (int j = 0; j < m; j++)
      if (s[j] == '1') val += (1ll << j);
    a[i] = val;
    st.insert(val);
  }
  sort(a, a + n);
  long long l = 0, r = (1ll << m) - 1;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (in(mid)) {
      for (long long i = 1;; i++) {
        if (mid - i >= l && (!in(mid - i))) {
          mid = mid - i;
          break;
        }
        if (mid + i <= r && (!in(mid + i))) {
          mid = mid + i;
          break;
        }
      }
    }
    long long lcnt = mid, rcnt = (1ll << m) - lcnt - 1;
    int pos = 0;
    while (pos < n && a[pos] < mid) pos++;
    lcnt -= pos;
    rcnt -= (n - pos);
    if (lcnt == rcnt || lcnt == rcnt - 1) {
      output(mid, m);
      return;
    }
    if (lcnt > rcnt)
      r = mid - 1;
    else
      l = mid + 1;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int q;
  cin >> q;
  while (q--) test();
  return 0;
}
