#include <bits/stdc++.h>
using namespace std;
template <class T>
bool mysort(T a, T b) {
  return (a < b);
}
int t = 0;
char arr[101][61] = {0};
map<long long, bool> rev;
long long b2l(int f, int len) {
  long long res = 0;
  for (int i = 0; i < len; i++) {
    res = res * 2 + (arr[f][i] ^ '0');
  }
  return res;
}
void l2b(long long num, int len, char *b) {
  len--;
  while (num) {
    *(b + len) = num % 2;
    num /= 2;
    len--;
  }
}
int solution(int n, int m) {
  long long total = pow(2, m);
  int big = 0, little = 0;
  long long index = (total - n - 1) / 2;
  ;
  for (auto v : rev) {
    ;
    if (v.first > index) break;
    if (v.first <= index) {
      index++;
    }
  };
  char binary[61] = {0};
  l2b(index, m, binary);
  for (int i = 0; i < m; i++) {
    cout << (int)binary[i];
  }
  cout << endl;
  return 0;
}
int main() {
  scanf("%d", &t);
  while (t--) {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
      long long res = b2l(i, m);
      ;
      rev[res] = true;
    }
    solution(n, m);
    rev.clear();
  }
  return 0;
}
