#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, m;
  cin >> n;
  cin >> m;
  vector<long long int> kd(n);
  set<long long int> st;
  for (long long int i = 0; i < n; ++i) {
    string str;
    cin >> str;
    for (auto ch : str) {
      kd[i] *= 2;
      kd[i] += (ch - '0');
    }
    st.insert(kd[i]);
  }
  sort(kd.begin(), kd.end());
  long long int lo = 0;
  long long int hi = (1ll << m) - 1;
  long long int res = -1;
  long long int pm = hi + 1 - n;
  pm = (pm - 1) / 2;
  pm += 1;
  while (lo <= hi) {
    long long int mid = ((lo + hi) >> 1);
    long long int tot = mid;
    long long int ext = upper_bound(kd.begin(), kd.end(), mid) - kd.begin() - 1;
    tot -= ext;
    if (tot >= pm) {
      if (st.find(mid) == st.end()) {
        res = mid;
      }
      hi = mid - 1;
    } else {
      lo = mid + 1;
    }
  }
  for (long long int i = m - 1; i >= 0; i--) {
    (res & (1ll << i)) ? cout << "1" : cout << "0";
  }
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
