#include <bits/stdc++.h>
using namespace std;
map<long long int, bool> mapi;
int main() {
  long long int t, n, m, k, i;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    mapi.clear();
    long long int tot = (long long int)pow(2, m);
    long long int mediana = (tot / 2) - 1;
    string s;
    while (n--) {
      cin >> s;
      k = 0;
      for (i = 0; i < m; i++) {
        if (s[i] == '1') k = k | (1LL << (m - i - 1));
      }
      if (tot % 2 == 0) {
        if (k <= mediana) {
          mediana++;
          while (mapi[mediana] == true) mediana++;
        }
      } else {
        if (k >= mediana) {
          mediana--;
          while (mapi[mediana] == true) mediana--;
        }
      }
      mapi[k] = true;
      tot--;
    }
    for (i = m - 1; i >= 0; i--) {
      if (mediana & (1LL << i))
        cout << "1";
      else
        cout << "0";
    }
    cout << endl;
  }
  return 0;
}
