#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 10;
long long a[N], n, m;
void print(long long w) {
  vector<int> G;
  while (w) G.push_back(w % 2), w >>= 1;
  while (G.size() < m) G.push_back(0);
  for (int i = G.size() - 1; i >= 0; i--) cout << G[i];
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
      string s;
      cin >> s;
      long long x = 0;
      for (char c : s) {
        x = x * 2 + (c - '0');
      }
      a[i] = x;
    }
    sort(a + 1, a + n + 1);
    long long MID = ((1ll << m) - 2) / 2;
    long long L = max(0ll, MID - n), R = min((1ll << m) - 1, MID + n);
    for (long long w = L; w <= R; w++) {
      int xb = lower_bound(a + 1, a + n + 1, w) - a;
      if (a[xb] == w) continue;
      long long left = xb - 1, right = n - xb + 1;
      left = w - 1 - left + 1;
      right = (1ll << m) - 1 - w - right;
      if (left == right || left == right - 1) {
        print(w);
        break;
      }
    }
  }
}
