#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& cout, vector<T> V) {
  cout << "[ ";
  for (auto v : V) cout << v << ' ';
  return cout << ']';
}
template <class L, class R>
ostream& operator<<(ostream& cout, pair<L, R> P) {
  return cout << '(' << P.first << ',' << P.second << ')';
}
long long int bin_to_int(string& s) {
  long long int n = s.size();
  long long int ans = 0;
  for (long long int i = 0; i < n; i++) {
    ans *= 2;
    ans += s[i] - '0';
  }
  return ans;
}
string bin(long long int n) {
  string ans = "";
  while (n) {
    if (n % 2)
      ans += '1';
    else
      ans += '0';
    n /= 2;
  }
  reverse(ans.begin(), ans.end());
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int m;
    cin >> m;
    vector<long long int> a(n);
    unordered_set<long long int> us;
    for (long long int i = 0; i < (n); i++) {
      string s;
      cin >> s;
      a[i] = bin_to_int(s);
      us.insert(a[i]);
    }
    long long int tot = (1ll << m);
    long long int k = tot - n;
    long long int lo = 0, hi = tot - 1;
    while (lo < hi) {
      long long int mid = (lo + hi) / 2;
      long long int l = mid;
      for (long long int i = 0; i < (n); i++) {
        if (a[i] < mid) {
          l--;
        }
      }
      long long int wanted = (k - 1) / 2;
      long long int index = l;
      if (index < wanted) {
        lo = mid + 1;
      } else if (index > wanted) {
        hi = mid - 1;
      } else {
        lo = hi = mid;
      }
    }
    long long int ans = (lo + hi) / 2;
    while (us.find(ans) != us.end()) ans++;
    string fans = bin(ans);
    while (fans.size() < m) fans = '0' + fans;
    cout << fans << '\n';
  }
  cerr << "Time : " << 1000 * (long double)clock() / (long double)CLOCKS_PER_SEC
       << "ms\n";
  ;
}
