#include <bits/stdc++.h>
using namespace std;
const long long num = 1e18 + 1;
const int mod = 1e9 + 7;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<long long> v;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    long long x = 0;
    for (int j = 0; j < s.size(); j++) {
      x *= 2;
      if (s[j] == '1') x += 1;
    }
    v.push_back(x);
  }
  unordered_map<long long, bool> mp;
  long long z = pow(2, m);
  long long med = (z - 1) / 2;
  for (int i = 0; i < v.size(); i++) {
    if ((z - 1) & 1) {
      if (v[i] <= med) {
        while (mp[++med])
          ;
      }
      mp[v[i]] = true;
      z--;
    } else {
      if (v[i] >= med) {
        while (mp[--med])
          ;
      }
      mp[v[i]] = true;
      z--;
    }
  }
  string ans;
  for (int i = m - 1; i >= 0; i--) {
    if ((1ll << i) & med)
      ans.push_back('1');
    else
      ans.push_back('0');
  }
  cout << ans << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
}
