#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 10;
const long long mod = 1e9 + 7;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  return x * f;
}
long long n, tot;
long long a[N], c[N], fac[N];
vector<long long> v;
bool cmp(int x, int y) { return x > y; }
string s;
int main() {
  long long k, q, _;
  long long m;
  fac[0] = 1;
  for (int i = 1; i <= 61; i++) {
    fac[i] = (fac[i - 1] * 2);
  }
  cin >> _;
  while (_--) {
    cin >> n >> m;
    v.clear();
    for (int i = 0; i < n; i++) {
      cin >> s;
      int len = s.length();
      long long num = 0;
      for (int j = 0; j < len; j++)
        if (s[j] == '1') num += (s[j] - '0') * fac[len - 1 - j];
      v.push_back(num);
    }
    sort(v.begin(), v.end());
    long long cnt = (fac[m] - n - 1) / 2, now = 0, sz = v.size();
    for (int i = 0; i < v.size(); i++) {
      if (v[i] <= cnt) {
        cnt++;
      } else {
        break;
      }
    }
    s = "";
    for (int i = 0; i < m; i++) {
      if (cnt % 2 == 0)
        s += '0';
      else
        s += '1';
      cnt /= 2;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
  }
}
