#include <bits/stdc++.h>
using namespace std;
const int maxn = 60;
int mp[maxn][maxn];
int main() {
  int t;
  cin >> t;
  while (t--) {
    vector<long long> v;
    long long n, m;
    cin >> n >> m;
    string s;
    for (int i = 1; i <= n; i++) {
      cin >> s;
      long long sum = 0;
      for (int j = 0; j < m; j++) sum = sum * 2 + s[j] - '0';
      v.push_back(sum);
    }
    long long all = 1ll << m;
    long long md = (all - 1) / 2;
    map<long long, long long> mp;
    for (int i = 0; i < n; i++) {
      mp[v[i]] = 1;
      if (all % 2 == 0) {
        if (v[i] <= md) {
          md++;
          while (mp[md]) md++;
        }
      } else {
        if (v[i] >= md) {
          md--;
          while (mp[md]) md--;
        }
      }
      all--;
    }
    string ch;
    for (int i = 0; i < m; i++) {
      if (md >> i & 1)
        ch += '1';
      else
        ch += '0';
    }
    reverse(ch.begin(), ch.end());
    cout << ch << endl;
  }
}
