#include <bits/stdc++.h>
using namespace std;
int t;
long long n, m;
long long k;
long long get(string s) {
  long long ret = 0;
  int cnt = 0;
  for (int i = s.length() - 1; i >= 0; i--) {
    ret += (s[i] == '1') * (powl(2LL, cnt));
    cnt++;
  }
  return ret;
}
map<long long, long long> ma;
set<long long> se;
long long ch(long long mid) {
  long long bef = 0;
  set<long long>::iterator it;
  it = se.lower_bound(mid);
  long long x = *it;
  if (x != mid || it == se.end()) {
    if (it == se.begin())
      bef = 0;
    else {
      it--;
      x = *it;
    }
  }
  if (x <= mid) bef = ma[x];
  long long ret = mid + 1 - bef;
  return ret;
}
map<long long, long long> ma2;
long long bs(long long l, long long h) {
  if (l > h) return -1;
  long long mid = (l + h) / 2LL;
  long long c = ch(mid);
  if (c < (k - 1) / 2LL + 1) return bs(mid + 1, h);
  if (c > (k - 1) / 2LL + 1) return bs(l, mid - 1);
  if (ma2[mid] == 1) return bs(l, mid - 1);
  return mid;
}
string getAns(long long x) {
  string ret = "";
  for (int i = 0; i < m; i++) {
    if (x % 2 == 1)
      ret += '1';
    else
      ret += '0';
    x /= 2LL;
  }
  reverse(ret.begin(), ret.end());
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> t;
  while (t--) {
    se.clear();
    ma.clear();
    ma2.clear();
    vector<long long> v;
    cin >> n >> m;
    k = powl(2, m) - n;
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      long long num = get(s);
      v.push_back(num);
      ma2[num] = 1;
      se.insert(num);
    }
    sort(v.begin(), v.end());
    int cnt = 0;
    for (auto u : v) {
      cnt++;
      ma[u] = cnt;
    }
    long long ans = bs(0, (long long)(1LL << m) - 1LL);
    string anss = getAns(ans);
    cout << anss << endl;
  }
  return 0;
}
