#include <bits/stdc++.h>
using namespace std;
long long int po(long long int x, long long int n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return po((x * x) % 1000000007, n / 2);
  else
    return (x * po((x * x) % 1000000007, (n - 1) / 2)) % 1000000007;
}
long long int GCD(long long int A, long long int B) {
  if (B == 0)
    return A;
  else
    return GCD(B, A % B);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long int t = 1;
  cin >> t;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    vector<long long int> re;
    set<long long int> s;
    for (int i = 0; i < n; ++i) {
      string st;
      cin >> st;
      long long int r = 1, e = 0;
      for (int i = st.length() - 1; i >= 0; --i, r *= 2) e += r * (st[i] - '0');
      re.push_back(e);
      s.insert(e);
    }
    long long int si = pow(2, m) - n;
    long long int d = (si - 1) / 2;
    long long int l = 0, h = pow(2, m) - 1;
    long long int an = -1;
    sort(re.begin(), re.end());
    while (l <= h) {
      long long int mi = (l + h) / 2;
      long long int mih = mi;
      while (mih <= h && s.find(mih) != s.end()) mih++;
      if (mih > h) {
        h = mi - 1;
        continue;
      }
      long long int de = upper_bound(re.begin(), re.end(), mih) - re.begin();
      if (mih - de == d) {
        an = mih;
        break;
      } else if (mih - de < d)
        l = mih + 1;
      else
        h = mi - 1;
    }
    string ans = "";
    long long int c = 0;
    while (c < m) {
      ans.push_back(an % 2 + '0');
      c++;
      an /= 2;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << "\n";
  }
}
