#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
inline long long read() {
  char ch = getchar();
  long long x = 0, f = 0;
  while (ch < '0' || ch > '9') f |= ch == '-', ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return f ? -x : x;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long N = 105;
long long a[N];
string st;
long long n, m;
long long k;
long long kans;
long long check(long long x) {
  long long cnt = 0;
  for (register long long i = 1; i <= n; i++) {
    if (a[i] < x) cnt++;
  }
  return cnt;
}
signed main() {
  long long T;
  cin >> T;
  while (T--) {
    n = read(), m = read();
    bitset<60> l("0");
    string s = "";
    for (register long long i = 1; i <= m; i++) s += '1';
    bitset<60> r(s);
    set<long long> se;
    for (register long long i = 1; i <= n; i++) {
      cin >> st;
      bitset<60> t(st);
      a[i] = (long long)t.to_ullong();
      se.insert(a[i]);
    }
    long long le = l.to_ullong(), ri = r.to_ullong();
    long long mid = ri / 2;
    k = (ri + 1 - n - 1) / 2;
    for (register long long i = max(0ll, mid - 105); i <= min(ri, mid + 105ll);
         i++) {
      if (se.find(i) != se.end()) continue;
      if (i - check(i) == k) {
        bitset<60> t(i);
        vector<long long> vec;
        for (register long long j = 0; j <= m - 1; j++) {
          vec.push_back(t[j]);
        }
        reverse(vec.begin(), vec.end());
        for (auto i : vec) cout << i;
        cout << endl;
        break;
      }
    }
  }
  return 0;
}
