#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y) {
  if (y == 0) return 1;
  long long p = power(x, y / 2);
  p = (p * p);
  return (y % 2 == 0) ? p : (x * p);
}
void solve() {
  long long n, m;
  cin >> n >> m;
  vector<string> a(n);
  map<long long, long long> map;
  for (auto& i : a) {
    cin >> i;
    long long temp = 0;
    for (long long j = 0; j < m; j++)
      temp += (i[j] - '0') * power(2, m - 1 - j);
    map[temp] = 0;
  }
  long long curr = (power(2, m - 1)) - 1, need = (power(2, m) - n - 1) / 2 + 1;
  long long ls = curr, rs = (power(2, m) - 1) / 2 - curr - 1;
  while (1) {
    long long left = curr + 1;
    bool f = 0;
    for (auto i : map) {
      f |= i.first == curr;
      if (i.first <= curr) left--;
    }
    if (left == need && !f) {
      string s;
      for (long long i = 0; i < m; i++) {
        s += (char)(curr % 2 + '0');
        curr /= 2;
      }
      reverse(s.begin(), s.end());
      cout << s << '\n';
      return;
    } else if (left < need) {
      curr++;
    } else {
      curr--;
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long T = 1;
  cin >> T;
  while (T--) solve();
}
