#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, k;
vector<pair<long long, string> > s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    for (int i = 0; i < n; i++) {
      string x;
      cin >> x;
      long long is = 0;
      for (int j = 0; j < x.size(); j++) {
        is *= 2;
        if (x[j] == '1') is++;
      }
      s.push_back({is, x});
    }
    sort(s.begin(), s.end());
    long long l = 0, r, rr = 1, mid;
    for (int i = 0; i < k; i++) rr *= 2;
    rr--;
    r = rr;
    while (l < r) {
      mid = (l + r) / 2;
      long long ls = 0, mr = 0;
      for (int i = n - 1; i >= 0; i--) {
        long long x = s[i].first;
        if (mid >= x)
          ls++;
        else
          mr++;
      }
      long long dif = rr - mid - mr;
      if (dif > (rr - n + 1) / 2)
        l = mid + 1;
      else
        r = mid;
    }
    string ans;
    while (l) {
      ans.push_back(l % 2 + '0');
      l /= 2;
    }
    while (ans.size() != k) ans.push_back('0');
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    s.clear();
  }
}
