#include <bits/stdc++.h>
using namespace std;
long long get_first(function<bool(long long)> f, long long L, long long R) {
  while (L < R) {
    long long mid = (L + R) / 2;
    f(mid) ? R = mid : L = mid + 1;
  }
  return L;
}
long long get_last(function<bool(long long)> f, long long L, long long R) {
  while (L < R) {
    long long mid = (L + R + 1) / 2;
    f(mid) ? L = mid : R = mid - 1;
  }
  return L;
}
void solve() {
  long long n, m;
  cin >> n >> m;
  vector<long long> a(n);
  set<long long> st;
  for (long long i = 0; i < (n); i++) {
    string s;
    cin >> s;
    long long ret = 0;
    reverse(s.begin(), s.end());
    for (long long j = (m)-1; j >= 0; j--) ret += (1LL << j) * (s[j] - '0');
    a[i] = ret;
    st.insert(ret);
  }
  long long rem = (1LL << m) - n;
  long long need = (rem - 1) / 2;
  auto f = [&](long long m) {
    long long cnt = 0;
    for (long long i = 0; i < (n); i++)
      if (a[i] < m) cnt++;
    return (m - cnt) >= need;
  };
  long long ans = get_first(f, 0, (1LL << m) - 1);
  while (st.count(ans)) ans++;
  for (long long i = (m)-1; i >= 0; i--) cout << (ans >> i & 1);
  cout << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
