#include <bits/stdc++.h>
using namespace std;
int t, n, m;
long long a, k, ak;
char c;
unordered_map<long long, bool> ma;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  for (int ti = 1; ti <= t; ++ti) {
    ma.clear();
    cin >> n >> m;
    k = (1ll << m) - n;
    for (int i = 1; i <= n; ++i) {
      a = 0;
      for (int j = m - 1; j >= 0; --j) {
        cin >> c;
        a |= (c == '1' ? (1ll << j) : 0ll);
      }
      ma[a] = 1;
    }
    a = (k - 1) / 2;
    ak = k = a + 1;
    for (pair<long long, bool> tw : ma) {
      if (tw.first <= a) --ak;
    }
    while (ak < k) {
      if (!ma[++a]) ++ak;
    }
    for (int i = m - 1; i >= 0; --i) {
      cout << (a & (1ll << i) ? 1 : 0);
    }
    cout << "\n";
  }
  return 0;
}
