#include <bits/stdc++.h>
using namespace std;
long long cur, need, n, m, th, k = 1;
vector<long long> v, p;
long long go(string s) {
  long long r = 0;
  for (int i = m - 1; i >= 0; i--) {
    r += p[m - 1 - i] * (s[i] - '0');
  }
  return r;
}
void go2(long long d) {
  for (int i = m - 1; i >= 0; i--) {
    if (p[i] <= d) {
      cout << 1;
      d -= p[i];
    } else {
      cout << 0;
    }
  }
  cout << endl;
}
void solve() {
  cin >> n >> m;
  v.clear();
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    v.push_back(go(s));
  }
  need = ((1ll << m) - n - 1) / 2 + 1;
  cur = ((1ll << m) - 1) / 2;
  while (true) {
    th = cur + 1;
    bool f = 0;
    for (int i = 0; i < n; i++) {
      if (v[i] == cur) {
        f = 1;
      }
      if (v[i] < cur) {
        th--;
      }
    }
    if (th == need && !f) {
      go2(cur);
      return;
    } else if (th <= need) {
      cur++;
    } else {
      cur--;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  for (int i = 0; i <= 60; i++) {
    p.push_back(k);
    k *= 2;
  }
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
