#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
typedef long long int ll;
#define INF 1e17
#define PI 3.14159265358979323846
int del_x[4] = {-1, 1, 0, 0};
int del_y[4] = {0, 0, 1, -1};
int XX[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int YY[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
string bin(ll num, ll m){
string s;
while(num){
int r = num%2;
num = num /2;
s += r + '0';
}
while(s.length() < m){
s += '0';
}
reverse(s.begin(), s.end());
return s;
}
int main(){
#ifndef ONLINE_JUDGE
clock_t tStart = clock();
#endif
ios_base:: sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while(t--){
int n, m;
cin >> n >> m;
string s;
vector<ll> v(n);
cin.ignore(n,'\n');
for(int i = 0; i < n; i++){
getline(cin, s);
for(int j = 0; j < m; j++){
v[i] *= 2;
v[i] += s[j] - '0';
}
}
ll index = ((1LL << m)-n-1)/2;
bool Find = false;
int prevCnt = 0;
while(!Find){
int cnt = 0;
for(int i = 0; i < n; i++){
//cout << "v[i] is "<< v[i]<<"\n";
if(v[i] <= index){
cnt++;
}
}
index += (cnt-prevCnt);
//cout << "cnt is "<<cnt<<"\n";
if(cnt-prevCnt == 0){
Find = true;
break;
}
prevCnt = cnt;
}
cout << bin(index, m)<<"\n";
}
/* #ifndef ONLINE_JUDGE
printf("\nRun Time -> %.10fs\n", (double)(clock()-tStart) / CLOCKS_PER_SEC);
#endif */
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI3ByYWdtYSBHQ0Mgb3B0aW1pemUoIk9mYXN0IikKI3ByYWdtYSBHQ0MgdGFyZ2V0KCJhdngsYXZ4MixmbWEiKQojcHJhZ21hIEdDQyBvcHRpbWl6YXRpb24gKCJPMyIpCiNwcmFnbWEgR0NDIG9wdGltaXphdGlvbiAoInVucm9sbC1sb29wcyIpCnR5cGVkZWYgbG9uZyBsb25nIGludCBsbDsKI2RlZmluZSBJTkYgMWUxNwojZGVmaW5lIFBJIDMuMTQxNTkyNjUzNTg5NzkzMjM4NDYKaW50IGRlbF94WzRdID0gey0xLCAxLCAwLCAwfTsKaW50IGRlbF95WzRdID0gezAsIDAsIDEsIC0xfTsKaW50IFhYWzhdID0gey0xLCAtMSwgLTEsIDAsIDEsIDEsIDEsIDB9OwppbnQgWVlbOF0gPSB7LTEsIDAsIDEsIDEsIDEsIDAsIC0xLCAtMX07CiAKc3RyaW5nIGJpbihsbCBudW0sIGxsIG0pewogICAgc3RyaW5nIHM7CiAgICB3aGlsZShudW0pewogICAgICAgIGludCByID0gbnVtJTI7CiAgICAgICAgbnVtID0gbnVtIC8yOwogICAgICAgIHMgKz0gciArICcwJzsKICAgIH0KICAgIHdoaWxlKHMubGVuZ3RoKCkgPCBtKXsKICAgICAgICBzICs9ICcwJzsKICAgIH0KICAgIHJldmVyc2Uocy5iZWdpbigpLCBzLmVuZCgpKTsKICAgIHJldHVybiBzOwp9CmludCBtYWluKCl7CiAgICAjaWZuZGVmIE9OTElORV9KVURHRQogICAgY2xvY2tfdCB0U3RhcnQgPSBjbG9jaygpOwogICAgI2VuZGlmCiAgICBpb3NfYmFzZTo6IHN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CiAgICBjaW4udGllKDApOwogICAgaW50IHQ7CiAgICBjaW4gPj4gdDsKICAgIHdoaWxlKHQtLSl7CiAgICAgICAgaW50IG4sIG07CiAgICAgICAgY2luID4+IG4gPj4gbTsKICAgICAgICBzdHJpbmcgczsKICAgICAgICB2ZWN0b3I8bGw+IHYobik7CiAgICAgICAgY2luLmlnbm9yZShuLCdcbicpOwogICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuOyBpKyspewogICAgICAgICAgICBnZXRsaW5lKGNpbiwgcyk7CiAgICAgICAgICAgIGZvcihpbnQgaiA9IDA7IGogPCBtOyBqKyspewogICAgICAgICAgICAgICAgdltpXSAqPSAyOwoJCQkJdltpXSArPSBzW2pdIC0gJzAnOwogICAgICAgICAgICB9CiAgICAgICAgfQogCiAgICAgICAgbGwgaW5kZXggPSAoKDFMTCA8PCBtKS1uLTEpLzI7CiAgICAgICAgYm9vbCBGaW5kID0gZmFsc2U7CiAgICAgICAgaW50IHByZXZDbnQgPSAwOwogICAgICAgIHdoaWxlKCFGaW5kKXsKICAgICAgICAgICAgaW50IGNudCA9IDA7CiAgICAgICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuOyBpKyspewogICAgICAgICAgICAgICAgLy9jb3V0IDw8ICJ2W2ldIGlzICI8PCB2W2ldPDwiXG4iOwogICAgICAgICAgICAgICAgaWYodltpXSA8PSBpbmRleCl7CiAgICAgICAgICAgICAgICAgICAgY250Kys7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaW5kZXggKz0gKGNudC1wcmV2Q250KTsKICAgICAgICAgICAgLy9jb3V0IDw8ICJjbnQgaXMgIjw8Y250PDwiXG4iOwogCiAgICAgICAgICAgIGlmKGNudC1wcmV2Q250ID09IDApewogICAgICAgICAgICAgICAgRmluZCA9IHRydWU7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfQogICAgICAgICAgICBwcmV2Q250ID0gY250OwogICAgICAgIH0KICAgICAgICBjb3V0IDw8IGJpbihpbmRleCwgbSk8PCJcbiI7CiAKICAgIH0KIAogCiAgICAvKiAjaWZuZGVmIE9OTElORV9KVURHRQogICAgcHJpbnRmKCJcblJ1biBUaW1lIC0+ICUuMTBmc1xuIiwgKGRvdWJsZSkoY2xvY2soKS10U3RhcnQpIC8gQ0xPQ0tTX1BFUl9TRUMpOwogICAgI2VuZGlmICAqLwogCn0=