#include <bits/stdc++.h>
using namespace std;
string a[1000];
vector<long long> v;
long long to_decimal(string str) {
  long long k = 1;
  int n = str.size();
  long long ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (str[i] == '1') {
      ans += k;
    }
    k *= 2;
  }
  return ans;
}
string to_binary(long long x, int m) {
  string ans = "";
  while (x > 0) {
    if (x % 2 == 0) {
      ans = "0" + ans;
    } else {
      ans = "1" + ans;
    }
    x /= 2;
    m--;
  }
  for (int i = 0; i < m; i++) {
    ans = "0" + ans;
  }
  return ans;
}
bool ok(long long x, int n, int m) {
  long long k = (1LL << m) - n;
  int monta = 0;
  for (long long val : v) {
    if (val < x) monta++;
  }
  if (x - monta <= (k - 1) / 2)
    return false;
  else
    return true;
}
void testCase() {
  int n, m;
  cin >> n >> m;
  v.clear();
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    v.push_back(to_decimal(a[i]));
  }
  long long k = (1LL << m) - n;
  long long x = -1;
  for (long long b = (1LL << m); b >= 1; b /= 2) {
    while (!ok(x + b, n, m)) x += b;
  }
  cout << to_binary(x, m) << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    testCase();
  }
}
