#include <bits/stdc++.h>
using namespace std;
template <class T>
using v2d = vector<vector<T> >;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int maxN = 1e5 + 10;
int n, m;
long long a[maxN];
long long s2i(string s) {
  long long ret = 0;
  for (auto &c : s) {
    ret = ret * 2 + (c - '0');
  }
  return ret;
}
string i2s(long long x) {
  string ret;
  while (x) {
    ret += (char)(x % 2 + '0');
    x /= 2;
  }
  while ((int)ret.size() < m) {
    ret += '0';
  }
  reverse((ret).begin(), (ret).end());
  return ret;
}
long long cnt(long long x) {
  long long ret = x + 1;
  ret -= upper_bound(a + 1, a + n + 1, x) - a - 1;
  return ret;
}
void solve() {
  cin >> n >> m;
  for (int i = 1; i <= (int)(n); ++i) {
    string s;
    cin >> s;
    a[i] = s2i(s);
  }
  sort(a + 1, a + n + 1);
  long long k = (1LL << m) - n;
  if (cnt(0) == (k - 1) / 2 + 1) {
    cout << i2s(0) << '\n';
    return;
  }
  long long l = 0, r = (1LL << m);
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    if (cnt(mid) < (k - 1) / 2 + 1) {
      l = mid;
    } else {
      r = mid;
    }
  }
  cout << i2s(l + 1) << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
