#include <bits/stdc++.h>
using namespace std;
long long a[110];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++) {
      string s;
      cin >> s;
      a[i] = 0;
      for (int j = 0; j < m; j++) a[i] = a[i] * 2 + (s[j] - '0');
    }
    long long mark = ((1LL << m) - n - 1) / 2;
    long long l = 0, r = (1LL << m) - 1, ans;
    while (l <= r) {
      long long mid = l + r >> 1;
      int cnt = 0;
      for (int i = 1; i <= n; i++)
        if (mid >= a[i]) cnt++;
      if (mid - cnt >= mark) {
        ans = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    for (int i = m - 1; i >= 0; i--) printf("%d", (ans >> i) & 1);
    puts("");
  }
  return 0;
}
