#include <bits/stdc++.h>
#pragma optimize("O3")
using namespace std;
const long long MOD = 998244353;
const long long INF = 1e12 + 7;
const int base = 2e5 + 1;
const int MAX = 1e5 + 2;
const double EPS = 1e-9;
const double PI = acos(-1.);
const int MAXN = 2 * 1e6 + 47;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<string> v;
int n, m;
long long need;
string make(long long x) {
  string s;
  while (x) {
    s += ('0' + x % 2);
    x /= 2;
  }
  while ((int)s.size() < m) s += '0';
  reverse(s.begin(), s.end());
  return s;
}
bool check(long long x) {
  string m = make(x);
  long long les = x;
  for (auto s : v) {
    if (s == m) return 0;
    if (s < m) les--;
  }
  return (les == need);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    need = (pow(2, m) - n - 1) / 2;
    v.resize(n);
    for (long long i = (0); i < (n); ++i) {
      cin >> v[i];
    }
    long long mid = pow(2, m - 1), res;
    for (long long i = (max(0ll, mid - 200)); i < (mid + 200); ++i) {
      if (check(i)) {
        res = i;
        break;
      }
    }
    cout << make(res) << '\n';
  }
  return 0;
}
