#include <bits/stdc++.h>
using namespace std;
template <class T, class V>
ostream &operator<<(ostream &s, pair<T, V> a) {
  s << a.first << ' ' << a.second;
  return s;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int T = 1;
  cin >> T;
  for (long long int qq = 1; qq <= T; qq++) {
    long long int n, m;
    cin >> n >> m;
    vector<string> v(n);
    for (auto &x : v) cin >> x;
    long long int k = ((1LL << m) - n - 1) / 2;
    sort(v.begin(), v.end());
    string ans;
    for (long long int i = 0; i < m; i++) {
      auto x = lower_bound(v.begin(), v.end(), ans);
      ans.push_back('1');
      auto y = lower_bound(v.begin(), v.end(), ans);
      ans.pop_back();
      long long int u = y - x;
      u = (1LL << (m - i - 1)) - u;
      if (u > k)
        ans.push_back('0');
      else
        ans.push_back('1'), k -= u;
    }
    cout << ans << endl;
  }
  return 0;
}
