#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
long long t, n, m;
long long a[maxn];
long long fuck(string tmp) {
  long long x = 1;
  long long ans = 0;
  for (int i = tmp.length() - 1; i >= 0; i--) {
    if (tmp[i] == '1') ans += x;
    x *= 2;
  }
  return ans;
}
int main() {
  cin >> t;
  while (t--) {
    cin >> n >> m;
    string tmp;
    for (int i = 0; i < n; i++) {
      cin >> tmp;
      a[i] = fuck(tmp);
    }
    sort(a, a + n);
    long long l = 0, r = (1ll << m) - 1 - n;
    long long mid = (l + r) >> 1;
    for (int i = 0; i < n; i++)
      if (a[i] <= mid) mid++;
    for (int i = m - 1; i >= 0; i--) printf("%d", (1ll << i) & mid ? 1 : 0);
    printf("\n");
  }
  return 0;
}
