#include <bits/stdc++.h>
using namespace std;
int n, m;
long long ord;
set<long long> v;
long long num(string s) {
  long long res = 0;
  for (int i = 0; i < m; i++) res = res * 2 + s[i] - '0';
  return res;
}
bool C(long long mid) {
  long long cnt = 0;
  while (v.count(mid)) mid--;
  for (long long x : v) {
    if (x <= mid) cnt++;
  }
  if (mid + 1 - cnt >= ord) return 1;
  return 0;
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    cin >> n >> m;
    v.clear();
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      v.insert(num(s));
    }
    ord = ((1ll << m) + 1 - n) / 2;
    long long l = -1, r = 1ll << m;
    while (r - l > 1) {
      long long mid = (l + r) / 2;
      if (C(mid))
        r = mid;
      else
        l = mid;
    }
    bitset<66> b = r;
    for (int i = m - 1; i >= 0; i--) {
      if (b[i] == 1)
        printf("1");
      else
        printf("0");
    }
    printf("\n");
  }
  return 0;
}
