#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  scanf("%d%d\n", &n, &m);
  set<long long> rem;
  for (int i = 0; i < n; i++) {
    long long a = 0;
    for (int i = 0; i < m; i++) {
      char c;
      scanf("%c", &c);
      a += ((long long)(c - '0')) << (m - i - 1);
    }
    rem.insert(a);
    scanf("\n");
  }
  rem.insert(((long long)1 << m));
  map<long long, int> idx;
  int i = 0;
  for (auto it = rem.begin(); it != rem.end(); it++, i++) {
    idx[*it] = i;
  }
  long long l = 0;
  long long r = ((long long)1 << m);
  long long count = ((long long)1 << m) - n;
  while (l < r - 1) {
    long long c = (l + r - 1) / 2;
    long long leq = c + 1;
    leq -= idx[*rem.upper_bound(c)];
    if (leq < count - leq)
      l = c + 1;
    else
      r = c + 1;
  }
  for (int d = m - 1; d >= 0; d--) {
    printf("%d", (l & ((long long)1 << d)) > 0);
  }
  printf("\n");
}
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 0; i < t; i++) solve();
}
