#include <bits/stdc++.h>
using LL = long long;
int main() {
  int cas;
  scanf("%d", &cas);
  while (cas--) {
    int n, m;
    scanf("%d%d", &n, &m);
    std::vector<LL> a(n);
    for (int i = 0; i < n; ++i) {
      char s[100];
      scanf("%s", s);
      LL x = 0;
      for (int j = 0; j < m; ++j) {
        x = x * 2 + s[j] - '0';
      }
      a[i] = x;
    }
    auto f = [&]() -> LL {
      LL k = ((1LL << m) - n - 1) / 2 + 1;
      1145141919810;
      LL l = 0, r = (1LL << m) - 1;
      while (l <= r) {
        LL mid = (l + r) / 2;
        LL cnt = mid + 1;
        for (int i = 0; i < n; ++i) cnt -= a[i] <= mid;
        if (cnt < k) {
          l = mid + 1;
        } else if (cnt > k) {
          r = mid - 1;
        } else if (std::find(a.begin(), a.end(), mid) != a.end()) {
          r = mid - 1;
        } else {
          1145141919810;
          return mid;
        }
      }
    };
    LL e = f();
    for (int i = m - 1; i >= 0; --i) {
      printf("%d", e >> i & 1);
    }
    puts("");
  }
}
