#include <bits/stdc++.h>
using namespace std;
void fileio() {}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long int btd(string s) {
  long long int ans = 0;
  long long int p = 1;
  for (long long int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == '1') {
      ans += p;
    }
    p *= 2;
  }
  return ans;
}
void solve() {
  long long int n, m;
  cin >> n >> m;
  vector<long long int> v;
  unordered_map<long long int, long long int> mm;
  for (long long int i = 0; i < n; i++) {
    string s;
    cin >> s;
    mm[btd(s)] = 1;
    v.push_back(btd(s));
  }
  long long int ans = 0;
  long long int req = ((1LL << m) - n - 1) / 2;
  long long int count = 0;
  long long int a = ((1LL << m) - 1) / 2;
  sort((v).begin(), (v).end());
  for (long long int i = 0; i < v.size(); i++) {
    if (v[i] < a) count++;
    if (v[i] == a) {
      count++;
      a++;
    }
  }
  count = a - count;
  if (count < req) {
    while (count != req) {
      a++;
      count++;
      while (mm.count(a) > 0) {
        a++;
      }
    }
  }
  if (count > req) {
    while (count != req) {
      a--;
      count--;
      while (mm.count(a) > 0) {
        a--;
      }
    }
  }
  for (long long int i = m - 1; i >= 0; i--) {
    if ((1LL << i) & a) {
      cout << 1;
    } else
      cout << 0;
  }
  cout << endl;
}
int32_t main() {
  fileio();
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  cin >> t;
  for (long long int yy = 1; yy <= t; yy++) {
    solve();
  }
  return 0;
}
