#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 100;
const long double pi = acos(-1.0);
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while ((ch < '0') || (ch > '9')) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ((ch >= '0') && (ch <= '9')) {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * f;
}
inline long long readll() {
  long long x = 0;
  int f = 1;
  char ch = getchar();
  while ((ch < '0') || (ch > '9')) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ((ch >= '0') && (ch <= '9')) {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * f;
}
int n, m;
string s[110];
bool chk(string s, string t, int len) {
  for (register int i = 0; i <= m - 1; i++) {
    char x, y = t[i];
    if (i <= len)
      x = s[i];
    else
      x = '0';
    if (x > y)
      return 1;
    else if (x < y)
      return 0;
  }
  return 0;
}
int main() {
  int T = read();
  while (T--) {
    n = read();
    m = read();
    for (register int i = 1; i <= n; i++) cin >> s[i];
    sort(s + 1, s + 1 + n);
    string ans = "";
    long long k = (1ll << m) - n, rnk = 0, ask = (k - 1) >> 1;
    for (register int i = 0; i <= m - 1; i++) {
      ans = ans + '1';
      int cnt = 0;
      for (register int j = 1; j <= n; j++) {
        if (chk(ans, s[j], i)) cnt++;
      }
      long long now = (1ll << (m - 1 - i)) - cnt;
      now += rnk;
      if (now > ask)
        ans[i] = '0';
      else
        rnk += (1ll << (m - i - 1));
    }
    cout << ans << endl;
  }
  return 0;
}
