#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, m, count;
    cin >> n >> m;
    count = 1;
    for (long long i = 0; i < m; i++) count *= 2;
    long long median = count / 2 + count % 2;
    median--;
    set<long long> data;
    while (n--) {
      string temp;
      cin >> temp;
      long long num = 0;
      long long tt = 1;
      if (temp.length() > 1) {
        for (long long i = temp.length() - 2; i >= 0; i--) {
          tt *= 2;
          if (temp[i] == '1') num += tt;
        }
      }
      if (temp[temp.length() - 1] == '1') num++;
      data.insert(num);
      if (num < median) {
        if (count % 2 == 0) {
          long long temp = median + 1;
          while (data.find(temp) != data.end() && temp >= 0) temp++;
          median = temp;
        }
      } else if (num > median) {
        if (count % 2) {
          long long temp = median - 1;
          while (data.find(temp) != data.end() && temp >= 0) temp--;
          median = temp;
        }
      } else {
        if (count % 2) {
          long long temp = median - 1;
          while (data.find(temp) != data.end() && temp >= 0) temp--;
          median = temp;
        } else {
          long long temp = median + 1;
          while (data.find(temp) != data.end() && temp >= 0) temp++;
          median = temp;
        }
      }
      count--;
    }
    char result[m];
    for (long long i = 0; i < m; i++) result[i] = '0';
    long long yy = m - 1;
    while (median > 0 && yy >= 0) {
      if (median % 2) result[yy] = '1';
      yy--;
      median /= 2;
    }
    for (long long i = 0; i < m; i++) cout << result[i];
    cout << endl;
  }
  return 0;
}
