#include <bits/stdc++.h>
int main() {
  int t;
  std::cin >> t;
  while (t--) {
    int n, m;
    std::cin >> n >> m;
    std::vector<int64_t> v(n);
    for (int i = 0; i < n; ++i) {
      std::string s;
      std::cin >> s;
      for (auto &c : s) {
        v[i] <<= 1;
        v[i] |= c - '0';
      }
    }
    int64_t curr = (1LL << (m - 1)) - 1;
    int64_t need = (((1LL << m) - n - 1) >> 1) + 1;
    bool flag = true;
    int64_t left = -1;
    while (left != need || flag) {
      flag = false;
      left = curr + 1;
      for (int i = 0; i < n; ++i) {
        flag |= v[i] == curr;
        if (v[i] <= curr) {
          left--;
        }
      }
      if (left < need) {
        curr++;
      } else if (left > need || flag) {
        curr--;
      }
    }
    int64_t mask = 1LL << (m - 1);
    while (mask) {
      std::cout << ((mask & curr) > 0);
      mask >>= 1;
    }
    std::cout << std::endl;
  }
  return 0;
}
