#include <bits/stdc++.h>
using namespace std;
const int mxN = 1e5 + 5;
const long long INF = 1e18;
const long long mod = 1e9 + 7;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    vector<string> v(n);
    long long med = ((1LL << m) - 1LL) / 2;
    for (int i = 0; i < n; i++) {
      cin >> v[i];
    }
    vector<long long> a;
    for (int i = 0; i < n; i++) {
      string temp = v[i];
      reverse((temp).begin(), (temp).end());
      long long x = 0;
      for (long long j = 0; j < m; j++) {
        if (temp[j] == '1') {
          x += (1LL << j);
        }
      }
      a.push_back(x);
    }
    sort((a).begin(), (a).end());
    set<long long> del;
    for (int i = 0; i < n; i++) {
      if (i % 2 == 0) {
        del.insert(a[i]);
        if (a[i] <= med) {
          med++;
          while (del.count(med)) {
            med++;
          }
        }
      } else {
        del.insert(a[i]);
        if (a[i] >= med) {
          med--;
          while (del.count(med)) {
            med--;
          }
        }
      }
    }
    string ans;
    while (med != 0) {
      long long x = med % 2;
      if (x == 1) {
        ans += '1';
      } else
        ans += '0';
      med = med / 2;
    }
    while (ans.size() != m) ans += '0';
    reverse((ans).begin(), (ans).end());
    cout << ans << endl;
  }
}
