#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t, n, m, i, med, mu, ct, num;
  cin >> t;
  string a;
  while (t--) {
    cin >> n >> m;
    med = (1ll << (m - 1)) - 1;
    ct = 0;
    unordered_set<long long> s;
    while (n--) {
      cin >> a;
      i = m - 1;
      mu = 1;
      num = 0;
      while (i > -1) {
        num += (a[i] - '0') * mu;
        mu *= 2;
        i--;
      }
      if (ct) {
        if (num >= med) {
          med--;
          while (s.find(med) != s.end()) med--;
        }
        s.insert(num);
      } else {
        if (num <= med) {
          med++;
          while (s.find(med) != s.end()) med++;
        }
        s.insert(num);
      }
      ct = 1 - ct;
    }
    i = m - 1;
    while (i > -1) {
      if (med % 2)
        a[i] = '1';
      else
        a[i] = '0';
      i--;
      med /= 2;
    }
    cout << a << "\n";
  }
}
