#include <bits/stdc++.h>
using namespace std;
long long to(string s) {
  long long val = 0;
  for (char c : s) {
    val *= 2;
    val += c - '0';
  }
  return val;
}
void solve() {
  int n, m;
  cin >> n >> m;
  vector<string> a(n);
  vector<long long> val(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    val[i] = to(a[i]);
  }
  long long k = (1ll << m) - n;
  k = (k - 1) / 2;
  string ans;
  for (int i = 0; i < m; ++i) {
    ans += '1';
    string kek = ans;
    kek.pop_back();
    kek += '0';
    while (kek.size() < m) {
      kek += '1';
    }
    long long x = to(kek);
    long long tot = x + 1;
    for (int j = 0; j < n; ++j) {
      if (val[j] <= x) {
        --tot;
      }
    }
    if (tot > k) {
      ans.pop_back();
      ans += '0';
    }
  }
  cout << ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
    cout << '\n';
  }
  return 0;
}
