#include <bits/stdc++.h>
using namespace std;
int id;
long long get(string s) {
  long long res = 0;
  int k = 0;
  reverse(s.begin(), s.end());
  for (auto t : s) {
    if (t == '1') res += ((long long)1 << k);
    k++;
  }
  return res;
}
void solve() {
  int n, m;
  map<long long, int> p;
  cin >> m >> n;
  long long sum = ((long long)1 << n) - 1;
  long long mid = (sum - 1) >> 1;
  int d[2] = {0};
  int st = 0;
  while (m--) {
    string s;
    cin >> s;
    long long t = get(s);
    p[t] = 1;
    if (t < mid)
      d[0]++;
    else if (t > mid)
      d[1]++;
    else
      st = 1;
  }
  int x = min(d[1], d[0]);
  d[0] -= x;
  d[1] -= x;
  if (d[0] > 0) {
    int dx = (d[0] + 1 + st) / 2;
    while (dx && mid < sum) {
      mid++;
      if (!p.count(mid)) dx--;
    }
  } else if (d[1] > 0) {
    int dx = (d[1] + st) / 2;
    while (dx && mid > 0) {
      mid--;
      if (!p.count(mid)) dx--;
    }
  } else {
    if (st) {
      while (p.count(mid)) mid++;
    }
  }
  for (int i = n - 1; i >= 0; i--)
    if (mid & ((long long)1 << i))
      cout << 1;
    else
      cout << 0;
  cout << endl;
}
int main() {
  int T;
  cin >> T;
  for (id = 1; id <= T; id++) solve();
  return 0;
}
