#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const long long INF = 0x3f3f3f3f;
const long long MOD = 1000000007;
void solve() {
  long long n, m;
  cin >> n >> m;
  vector<string> del(n);
  for (long long i = 0; i < n; i++) {
    cin >> del[i];
  }
  vector<long long> pow_2(m + 1);
  pow_2[0] = 1;
  for (long long i = 1; i <= m; i++) {
    pow_2[i] = pow_2[i - 1] * 2;
  }
  long long k = (pow_2[m] - n - 1) / 2;
  string s;
  for (long long i = 0; i < m; i++) {
    s.push_back('0');
    long long cnt0 = pow_2[m - 1 - i];
    for (long long j = 0; j < n; j++) {
      bool f = true;
      for (long long x = 0; x <= i; x++) {
        if (del[j][x] != s[x]) {
          f = false;
          break;
        }
      }
      cnt0 -= f;
    }
    if (k >= cnt0) {
      k -= cnt0;
      s.pop_back();
      s.push_back('1');
    }
  }
  cout << s << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long t;
  cin >> t;
  while (t--) solve();
}
