#include <bits/stdc++.h>
using namespace std;
int how_many(string s, vector<string>& deleted) {
  int res = 0;
  for (auto i : deleted)
    for (int j = 0; j < s.size(); j++) {
      if (i[j] != s[j]) break;
      if (j == s.size() - 1) res++;
    }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    vector<string> deleted(n);
    for (int i = 0; i < n; i++) cin >> deleted[i];
    string res = "";
    long long curr = ((1LL << m) + 1 - n) / 2;
    for (int i = 0; i < m; i++) {
      long long x = (1LL << (m - i - 1)) - how_many(res + '0', deleted);
      if (x >= curr)
        res.push_back('0');
      else {
        res.push_back('1');
        curr -= x;
      }
    }
    cout << res << "\n";
  }
  return 0;
}
