#include <bits/stdc++.h>
using namespace std;
template <typename T>
T sgn(T x) {
  return x < 0 ? -1 : x ^ 0;
}
template <typename T>
T gcd(T a, T b) {
  return a ? gcd(b % a, a) : b;
}
void reads(string& x) {
  char kk[((int)2e5 + 123)];
  scanf("%s", kk);
  x = kk;
}
long long n, cont, med, m;
string s;
string toBin(long long x) {
  string ans;
  while (x) {
    ans = ((char)('0' + x % 2)) + ans;
    x /= 2;
  }
  string r(m - (int)ans.size(), '0');
  return r + ans;
}
long long toDec(string x) {
  long long ans = 0;
  for (int i = 0; i < m; i++) {
    if (x[m - i - 1] == '1') ans |= (1ll << (i));
  }
  return ans;
}
void solve() {
  set<long long> val;
  scanf("%lld %lld", &n, &m);
  med = ((1ll << m) - n - 1ll) >> 1;
  for (int i = 0; i < n; i++) {
    reads(s);
    val.emplace(toDec(s));
  }
  for (long long x : val)
    if (x <= med) med++;
  printf("%s\n", toBin(med).data());
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  scanf("%d", &t);
  while (t--) {
    solve();
  }
}
