#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     while (t--) {       int n, m;       cin >> n >> m;       vector<long long> v(n);       for (int i = 0; i < n; i++) {         string s;         cin >> s;         long long a = 0;         for (int j = 0; j < m; j++) {           if (s[j] ==  1 ) {             a += (1LL << (m - 1 - j));           }         }         v[i] = a;       }       sort(v.begin(), v.end());       long long mid = (1LL << (m - 1)) - 1;       long long x = (1 << m);       for (int i = 0; i < n; i++) {         if (v[i] < mid) {           if (x % 2 == 0) mid++;           x--;         } else if (v[i] == mid) {           if (x % 2 == 0) {             mid++;             x--;           } else {             long long q = mid - 1;             int y;             while (1) {               y = 0;               for (int j = 0; j < n; j++) {                 if (q == v[j]) {                   q--;                   y = 1;                   break;                 }               }               if (!y) break;             }             mid = q;             x--;           }         } else {           if (x % 2) {             long long q = mid - 1;             int y;             while (1) {               y = 0;               for (int j = 0; j < n; j++) {                 if (q == v[j]) {                   q--;                   y = 1;                   break;                 }               }               if (!y) break;             }             mid = q;           }           x--;         }       }       for (int j = m - 1; j >= 0; j--) {         if (mid & (1LL << j)) {           cout << 1;         } else           cout << 0;       }       cout << endl;     }   }   