#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e16;
const long long mod = 1e9 + 7;
const long double PI = 3.14159265359;
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (T i : v) os << i << ' ';
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& v) {
  for (T i : v) os << i << ' ';
  return os;
}
template <class T, class S>
ostream& operator<<(ostream& os, const pair<T, S>& v) {
  os << v.first << ' ' << v.second;
  return os;
}
template <class T, class S>
ostream& operator<<(ostream& os, const unordered_map<T, S>& v) {
  for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' ';
  return os;
}
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target( \
    "avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
clock_t time_p = clock();
void starboy1299() {
  time_p = clock() - time_p;
  cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
const long long N = 55;
char arr[N][N];
long long f(string s) {
  reverse((s).begin(), (s).end());
  long long ans = 0;
  long long n = s.size();
  for (long long i = 0; i < n; i++) {
    long long bb = s[i] - '0';
    ans += (bb << i);
  }
  return ans;
}
bool ok(long long mid, set<long long>& s, long long med) {
  long long cnt = 0;
  for (auto it : s) {
    if (it < mid) cnt++;
  }
  if (mid - cnt > med) return 1;
  return 0;
}
string ff(long long n, long long m) {
  string ans = "";
  while (n > 0) {
    if (n & 1) {
      ans += '1';
    } else
      ans += '0';
    n /= 2;
  }
  long long sz = ans.size();
  for (long long i = sz; i < m; i++) {
    ans += '0';
  }
  reverse((ans).begin(), (ans).end());
  return ans;
}
void solve() {
  long long n, m;
  cin >> n >> m;
  long long aa = 0;
  for (long long i = 0; i < m; i++) {
    aa += (1LL << i);
  }
  set<long long> s;
  for (long long i = 0; i < n; i++) {
    string str;
    cin >> str;
    long long cc = f(str);
    s.insert(cc);
  }
  long long dd = (aa + 1 - n);
  long long med = (dd - 1) / 2;
  long long l = 0, e = (1LL << 60);
  while (l <= e) {
    long long mid = l + e >> 1;
    if (ok(mid, s, med)) {
      e = mid - 1;
    } else
      l = mid + 1;
  }
  cout << ff(e, m) << '\n';
}
int32_t main() {
  fast();
  long long t;
  cin >> t;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
  starboy1299();
}
