#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;

void decToBinary(int n,int m)
{
    // Size of an integer is assumed to be 32 bits
    for (int i = m-1; i >= 0; i--) {
        int k = n >> i;
        if (k & 1)
            cout << "1";
        else
            cout << "0";
    }
}
long long int c(string m){
    reverse(m.begin(), m.end());
    long long int a = 0,p = 1;
    for(int i = 0; i < m.size();i++){
        a += (m[i] - '0')*p;
        p*=2;
    }
    return a;
}

int main()
{
    int t;
    cin>>t;
    while(t--){
        int n,m;
        long long int ans;
        cin>>n>>m;
        vector <long long int> v;
        for(int i = 0;i < n;i++){
            string str;
            cin>>str;
            v.push_back(c(str));
        }

        int flag = 0;
        long long int mid  = ((1<<m)- 2)/2;
        unordered_map<long long int,int> vis;
        //for(int i = 0;i < n;i++) vis[v[i]] = 1;
        for(int i = 0;i<n;i++){
            vis[v[i]] = 1;
            if(flag==0){
                if(v[i]<=mid){
                    mid+=1;
                    while(vis[mid]==1){
                        //cout<<"YAY"<<"\n";
                        mid+=1;
                    }

                }
                else{

                }
            }
            else if(flag == 1){
                if(v[i]<mid){

                }
                else{
                    mid-=1;
                    while(vis[mid]==1&&mid>=0){
                        mid-=1;
                    }

                }
            }
            //cout<<mid<<"\n";
            flag =  1 - flag;

        }
        decToBinary(mid,m);
        cout<<"\n";

    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long int ll;
typedef pair<int,int> pii;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        ll n,m,i,j,k;
        cin>>n>>m;
        ll a[n];
        char s[m+1];
        for(i=0;i<n;i++){
            cin>>s;
            j=0;
            j=(s[0]=='1')?1:0;
            for(int l=1;l<m;l++){
                j=j<<1;
                j+=(s[l]=='1')?1:0;
            }
            a[i]=j;
        }
        sort(a,a+n);
        ll r=floor((pow(2,m)-n-1)/2.000);
        //cout<<r<<endl;
//        int g[n-1];
//        for(i=0;i<n-1;i++) g[i]=a[i]-a[i-1];
           k=0;
           //for(i=0;i<n;i++) cout<<a[i]<<" ";
           //cout<<endl;
        while(k<n && a[k]<=r){
            r++;
            k++;
        }
        stack<bool> ans;
        for(i=0;i<m;i++){
            ans.push(r%2);
            r/=2;
        }
        while(!ans.empty()){
            cout<<ans.top();
            ans.pop();
        }
        cout<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long int ll;
typedef pair<int,int> pii;
ll power(ll a,int n){
    if(n==0) return 1ll;
    if(n==1) return a;
    ll ans=power(a,n/2);
    ans*=ans;
    if(n%2) ans*=a;
    return ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        ll n,m,i,j,k;
        cin>>n>>m;
        ll a[n];
        char s[m+1];
        for(i=0;i<n;i++){
            cin>>s;
            j=0;
            j=(s[0]=='1')?1:0;
            for(int l=1;l<m;l++){
                j=j<<1;
                j+=(s[l]=='1')?1:0;
            }
            a[i]=j;
        }
        sort(a,a+n);
        ll r=power(2,m);
        r=(r-n-1)/2;
        //cout<<r<<endl;
//        int g[n-1];
//        for(i=0;i<n-1;i++) g[i]=a[i]-a[i-1];
           k=0;
           //for(i=0;i<n;i++) cout<<a[i]<<" ";
           //cout<<endl;
        while(k<n && a[k]<=r){
            r++;
            k++;
        }
        stack<bool> ans;
        for(i=0;i<m;i++){
            ans.push(r%2);
            r/=2;
        }
        while(!ans.empty()){
            cout<<ans.top();
            ans.pop();
        }
        cout<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long int ll;
typedef pair<int,int> pii;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        ll n,m,i,j,k;
        cin>>n>>m;
        ll a[n];
        char s[m+1];
        for(i=0;i<n;i++){
            cin>>s;
            j=0;
            j=(s[0]=='1')?1:0;
            for(int l=1;l<m;l++){
                j=j<<1;
                j+=(s[l]=='1')?1:0;
            }
            a[i]=j;
        }
        sort(a,a+n);
        int r=floor((pow(2,m)-n-1)/2.000);
        cout<<r<<endl;
//        int g[n-1];
//        for(i=0;i<n-1;i++) g[i]=a[i]-a[i-1];
           k=0;
           //for(i=0;i<n;i++) cout<<a[i]<<" ";
           //cout<<endl;
        while(k<n && a[k]<=r){
            r++;
            k++;
        }
        stack<bool> ans;
        for(i=0;i<m;i++){
            ans.push(r%2);
            r/=2;
        }
        while(!ans.empty()){
            cout<<ans.top();
            ans.pop();
        }
        cout<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long int ll;
typedef pair<int,int> pii;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--){
        ll n,m,i,j,k;
        cin>>n>>m;
        ll a[n];
        char s[m+1];
        for(i=0;i<n;i++){
            cin>>s;
            j=0;
            j=(s[0]=='1')?1:0;
            for(int l=1;l<m;l++){
                j=j<<1;
                j+=(s[l]=='1')?1:0;
            }
            a[i]=j;
        }
        sort(a,a+n);
        int r=floor((pow(2,m)-n-1)/2.000);
        //cout<<r<<endl;
//        int g[n-1];
//        for(i=0;i<n-1;i++) g[i]=a[i]-a[i-1];
           k=0;
           //for(i=0;i<n;i++) cout<<a[i]<<" ";
           //cout<<endl;
        while(k<n && a[k]<=r){
            r++;
            k++;
        }
        stack<bool> ans;
        for(i=0;i<m;i++){
            ans.push(r%2);
            r/=2;
        }
        while(!ans.empty()){
            cout<<ans.top();
            ans.pop();
        }
        cout<<endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int t,n,m;
string s,ans;
set<ll> st;
int main(){
    cin>>t;
    rep(tt,t){
        cin>>n>>m;
        st.clear();
        rep(i,n){
            cin>>s;
            ll si=0;
            rep(j,m)if(s[j]=='1') si|=(1ll<<(m-j-1));
            st.insert(si);
        }
        ll cur=1;
        rep(i,m-1) cur*=2;
        ll gc=(cur*2-m-1)/2;
        while(1){

            ll cnt=cur;
            for(auto it:st)if(it<cur) --cnt;
            if(cnt==gc){
                while(cur>=0&&st.count(cur)>0) --cur;
                if(cur<0){
                    while(st.count(cur)>0) ++cur;
                }
                break;
            }
            if(cnt>gc){
                while(st.count(cur)>0) --cur;
            }
            else{
                while(st.count(cur)>0) ++cur;
            }
        }
        ans="";
        rep(i,m){
            if(cur>>i&1) ans+='1';
            else ans+='0';
        }
        reverse(ans.begin(),ans.end());
        cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int t,n,m;
string s,ans;
vector<ll> v;
int main(){
    cin>>t;
    rep(tt,t){
        cin>>n>>m;
        v.clear();
        rep(i,n){
            cin>>s;
            ll si=0;
            rep(j,m)if(s[j]=='1') si|=(1ll<<(m-j-1));
            v.pb(si);
        }
        ll cur=1;
        rep(i,m-1) cur*=2;
        ll gc=(cur*2-n-1)/2+1;
        --cur;
        sort(v.begin(),v.end());
        while(1){

            ll cnt=cur+1,tmp=0;
            //tmp=lower_bound(v.begin(),v.end(),cur)-v.begin();
            bool ok=true;
            rep(i,n){
                if(v[i]<=cur) ++tmp;
                if(v[i]==cur) ok=false;
            }
            cnt-=tmp;
            if(cnt==gc&&ok){
                break;
            }
            if(cnt>=gc){
                --cur;
            }
            else{
                ++cur;
            }
        }
        ans="";
        rep(i,m){
            if(cur>>i&1) ans+='1';
            else ans+='0';
        }
        reverse(ans.begin(),ans.end());
        cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int t,n,m;
string s,ans;
vector<ll> v;
int main(){
    cin>>t;
    rep(tt,t){
        cin>>n>>m;
        v.clear();
        rep(i,n){
            cin>>s;
            ll si=0;
            rep(j,m)if(s[j]=='1') si|=(1ll<<(m-j-1));
            v.pb(si);
        }
        ll cur=1;
        rep(i,m-1) cur*=2;
        ll gc=(cur*2-n-1)/2;
        sort(v.begin(),v.end());
        while(1){

            ll cnt=cur,tmp;
            tmp=lower_bound(v.begin(),v.end(),cur)-v.begin();
            cnt-=tmp;
            if(cnt==gc){
                if(tmp==n){
                    break;
                }
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
                if(tmp<0){
                    cur=0,tmp=0;
                    while(v[tmp]==cur) ++cur,++tmp;
                }
                break;
            }
            if(cnt>gc){
                --cur,--tmp;
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
            }
            else{
                ++cur,++tmp;
                while(tmp<n&&v[tmp]==cur) ++cur,++tmp;
            }
        }
        ans="";
        rep(i,m){
            if(cur>>i&1) ans+='1';
            else ans+='0';
        }
        reverse(ans.begin(),ans.end());
        cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int t,n,m;
string s,ans;
vector<ll> v;
int main(){
    cin>>t;
    rep(tt,t){
        cin>>n>>m;
        v.clear();
        rep(i,n){
            cin>>s;
            ll si=0;
            rep(j,m)if(s[j]=='1') si|=(1ll<<(m-j-1));
            v.pb(si);
        }
        ll cur=1;
        rep(i,m-1) cur*=2;
        ll gc=(cur*2-m-1)/2;
        sort(v.begin(),v.end());
        while(1){

            ll cnt=cur,tmp;
            tmp=lower_bound(v.begin(),v.end(),cur)-v.begin();
            cnt-=tmp;
            if(cnt==gc){
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
                if(tmp<0){
                    cur=0,tmp=0;
                    while(v[tmp]==cur) ++cur,++tmp;
                }
                break;
            }
            if(cnt>gc){
                --cur,--tmp;
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
            }
            else{
                ++cur,++tmp;
                while(v[tmp]==cur) ++cur,++tmp;
            }
        }
        ans="";
        rep(i,m){
            if(cur>>i&1) ans+='1';
            else ans+='0';
        }
        reverse(ans.begin(),ans.end());
        cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int t,n,m;
string s,ans;
vector<ll> v;
int main(){
    cin>>t;
    rep(tt,t){
        cin>>n>>m;
        v.clear();
        rep(i,n){
            cin>>s;
            ll si=0;
            rep(j,m)if(s[j]=='1') si|=(1ll<<(m-j-1));
            v.pb(si);
        }
        ll cur=1;
        rep(i,m-1) cur*=2;
        ll gc=(cur*2-n-1)/2;
        sort(v.begin(),v.end());
        while(1){

            ll cnt=cur,tmp;
            tmp=lower_bound(v.begin(),v.end(),cur)-v.begin();
            cnt-=tmp;
            if(cnt==gc){
                if(tmp==n){
                    break;
                }
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
                if(tmp<0){
                    cur=0,tmp=0;
                    while(tmp<n&&v[tmp]==cur) ++cur,++tmp;
                }
                break;
            }
            if(cnt>gc){
                --cur,--tmp;
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
            }
            else{
                ++cur,++tmp;
                while(tmp<n&&v[tmp]==cur) ++cur,++tmp;
            }
        }
        ans="";
        rep(i,m){
            if(cur>>i&1) ans+='1';
            else ans+='0';
        }
        reverse(ans.begin(),ans.end());
        cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int t,n,m;
string s,ans;
vector<ll> v;
int main(){
    cin>>t;
    rep(tt,t){
        cin>>n>>m;
        v.clear();
        rep(i,n){
            cin>>s;
            ll si=0;
            rep(j,m)if(s[j]=='1') si|=(1ll<<(m-j-1));
            v.pb(si);
        }
        ll cur=1;
        rep(i,m-1) cur*=2;
        ll gc=(cur*2-m-1)/2;
        sort(v.begin(),v.end());
        while(1){

            ll cnt=cur,tmp;
            tmp=lower_bound(v.begin(),v.end(),cur)-v.begin();
            //for(auto it:st)if(it<cur) --cnt;
            cnt-=tmp;
            if(cnt==gc){
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
                if(tmp<0){
                    cur=0,tmp=0;
                    while(v[tmp]==cur) ++cur,++tmp;
                }
                break;
            }
            if(cnt>gc){
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
            }
            else{
                while(tmp>=0&&v[tmp]==cur) ++cur,++tmp;
            }
        }
        ans="";
        rep(i,m){
            if(cur>>i&1) ans+='1';
            else ans+='0';
        }
        reverse(ans.begin(),ans.end());
        cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int t,n,m;
string s,ans;
vector<ll> v;
int main(){
    cin>>t;
    rep(tt,t){
        cin>>n>>m;
        v.clear();
        rep(i,n){
            cin>>s;
            ll si=0;
            rep(j,m)if(s[j]=='1') si|=(1ll<<(m-j-1));
            v.pb(si);
        }
        ll cur=1;
        rep(i,m-1) cur*=2;
        ll gc=(cur*2-m-1)/2;
        sort(v.begin(),v.end());
        while(1){

            ll cnt=cur,tmp;
            tmp=lower_bound(v.begin(),v.end(),cur)-v.begin();
            cnt-=tmp;
            if(cnt==gc){
                if(tmp==n){
                    break;
                }
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
                if(tmp<0){
                    cur=0,tmp=0;
                    while(v[tmp]==cur) ++cur,++tmp;
                }
                break;
            }
            if(cnt>gc){
                --cur,--tmp;
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
            }
            else{
                ++cur,++tmp;
                while(tmp<n&&v[tmp]==cur) ++cur,++tmp;
            }
        }
        ans="";
        rep(i,m){
            if(cur>>i&1) ans+='1';
            else ans+='0';
        }
        reverse(ans.begin(),ans.end());
        cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int t,n,m;
string s,ans;
set<ll> st;
int main(){
    cin>>t;
    rep(tt,t){
        cin>>n>>m;
        st.clear();
        rep(i,n){
            cin>>s;
            ll si=0;
            rep(j,m)if(s[j]=='1') si|=(1ll<<(m-j-1));
            st.insert(si);
        }
        ll cur=1;
        rep(i,m-1) cur*=2;
        ll gc=(cur*2-m-1)/2;
        while(1){

            ll cnt=cur;
            for(auto it:st)if(it<cur) --cnt;
            if(cnt==gc){
                while(cur>=0&&st.count(cur)>0) --cur;
                if(cur<0){
                    cur=0;
                    while(st.count(cur)>0) ++cur;
                }
                break;
            }
            if(cnt>gc){
                while(st.count(cur)>0) --cur;
            }
            else{
                while(st.count(cur)>0) ++cur;
            }
        }
        ans="";
        rep(i,m){
            if(cur>>i&1) ans+='1';
            else ans+='0';
        }
        reverse(ans.begin(),ans.end());
        cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int t,n,m;
string s,ans;
vector<ll> v;
int main(){
    cin>>t;
    rep(tt,t){
        cin>>n>>m;
        v.clear();
        rep(i,n){
            cin>>s;
            ll si=0;
            rep(j,m)if(s[j]=='1') si|=(1ll<<(m-j-1));
            v.pb(si);
        }
        ll cur=1;
        rep(i,m-1) cur*=2;
        ll gc=(cur*2-n-1)/2+1;
        sort(v.begin(),v.end());
        while(1){

            ll cnt=cur+1,tmp;
            tmp=lower_bound(v.begin(),v.end(),cur)-v.begin();
            cnt-=tmp;
            if(cnt==gc){
                if(tmp==n){
                    break;
                }
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
                if(tmp<0){
                    cur=0,tmp=0;
                    while(tmp<n&&v[tmp]==cur) ++cur,++tmp;
                }
                break;
            }
            if(cnt>gc){
                --cur,--tmp;
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
            }
            else{
                ++cur,++tmp;
                while(tmp<n&&v[tmp]==cur) ++cur,++tmp;
            }
        }
        ans="";
        rep(i,m){
            if(cur>>i&1) ans+='1';
            else ans+='0';
        }
        reverse(ans.begin(),ans.end());
        cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int t,n,m;
string s,ans;
vector<ll> v;
int main(){
    cin>>t;
    rep(tt,t){
        cin>>n>>m;
        v.clear();
        rep(i,n){
            cin>>s;
            ll si=0;
            rep(j,m)if(s[j]=='1') si|=(1ll<<(m-j-1));
            v.pb(si);
        }
        ll cur=1;
        rep(i,m-1) cur*=2;
        ll gc=(cur*2-m-1)/2;
        sort(v.begin(),v.end());
        while(1){

            ll cnt=cur,tmp;
            tmp=lower_bound(v.begin(),v.end(),cur)-v.begin();
            cnt-=tmp;
            if(cnt==gc){
                if(tmp==n){
                    break;
                }
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
                if(tmp<0){
                    cur=0,tmp=0;
                    while(v[tmp]==cur) ++cur,++tmp;
                }
                break;
            }
            if(cnt>gc){
                --cur,--tmp;
                while(tmp>=0&&v[tmp]==cur) --cur,--tmp;
            }
            else{
                ++cur,++tmp;
                while(v[tmp]==cur) ++cur,++tmp;
            }
        }
        ans="";
        rep(i,m){
            if(cur>>i&1) ans+='1';
            else ans+='0';
        }
        reverse(ans.begin(),ans.end());
        cout<<ans<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
string prev(string s)
{
    ll i;
    for(i=s.size()-1;i>=0 && s[i]=='0';i--)
    s[i]='1';
    s[i]='0';
    return s;
}

string next(string s)
{
    ll i;
    for(i=s.size()-1;i>=0 && s[i]=='1';i--)
    s[i]='0';
    if(i==-1)
    {
        string one="1";
        s=one+s;
    }
    else
    s[i]='1';
    return s;
}

int main()
{
	ll t,cnt=0;
	cin>>t;
	while(t--)
	{
	    cnt++;
	    if(cnt==40)
	    cout<<"dfdfdgfdgfdgf"<<endl;
	    ll n,i,j,k,m,x,y,flag=0;
	    cin>>n>>m;ll diff=1;
	    string str,ans="0";
	    unordered_set<string> s;
	    for(i=1;i<m;i++)
	    ans+="1";
	    //cout<<ans;
	    for(i=0;i<n;i++)
	    {
	        cin>>str;
	        if(cnt==40)
	        cout<<str<<endl;
	        s.insert(str);
	       // cout<<str.compare(ans)<<" ";
	        if(str.compare(ans)>0)
	        {
	            diff--;
	            if(diff<0)
	            {
	                ans=prev(ans);
	                diff=1;
	            }
	        }
	        else if(str.compare(ans)<0)
	        {
	            diff++;
	            if(diff>1)
	            {
	                ans=next(ans);
	                diff=0;
	            }
	        }
	        else
	        {
	            while(s.find(ans)!=s.end())
	            {
	                if(diff==0)
	                {
	                     ans=prev(ans);
	                }
	                else
	                {
	                    ans=next(ans);
	                }
	            }
	            diff=(diff+1)%2;
	        }
	    }
	    cout<<ans<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
string prev(string s)
{
    ll i;
    for(i=s.size()-1;i>=0 && s[i]=='0';i--)
    s[i]='1';
    s[i]='0';
    return s;
}

string next(string s)
{
    ll i;
    for(i=s.size()-1;i>=0 && s[i]=='1';i--)
    s[i]='0';
    if(i==-1)
    {
        string one="1";
        s=one+s;
    }
    else
    s[i]='1';
    return s;
}

int main()
{
	ll t,cnt=0;
	cin>>t;
	while(t--)
	{
	    cnt++;

	    ll n,i,j,k,m,x,y,flag=0;
	    cin>>n>>m;ll diff=1;
	    string str,ans="0";
	    unordered_set<string> s;
	    for(i=1;i<m;i++)
	    ans+="1";
	    //cout<<ans;
	    for(i=0;i<n;i++)
	    {
	        cin>>str;
	        s.insert(str);
	        //cout<<str.compare(ans)<<" ";
	        if(str.compare(ans)>0)
	        {
	            diff--;
	            if(diff<0)
	            {
	                ans=prev(ans);
	                while(s.find(ans)!=s.end())
	                ans=prev(ans);
	                diff=1;
	            }
	        }
	        else if(str.compare(ans)<0)
	        {
	            diff++;
	            if(diff>1)
	            {
	                ans=next(ans);
	                while(s.find(ans)!=s.end())
	                ans=next(ans);
	                diff=0;
	            }
	        }
	        else
	        {
	            while(s.find(ans)!=s.end())
	            {
	                if(diff==0)
	                {
	                     ans=prev(ans);
	                }
	                else
	                {
	                    ans=next(ans);//cout<<ans<<" ";
	                }
	            }
	            diff=(diff+1)%2;
	        }
	    }
	    cout<<ans<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
string prev(string s)
{
    ll i;
    for(i=s.size()-1;i>=0 && s[i]=='0';i--)
    s[i]='1';
    s[i]='0';
    return s;
}

string next(string s)
{
    ll i;
    for(i=s.size()-1;i>=0 && s[i]=='1';i--)
    s[i]='0';
    if(i==-1)
    {
        string one="1";
        s=one+s;
    }
    else
    s[i]='1';
    return s;
}

int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
	    ll n,i,j,k,m,x,y,flag=0;
	    cin>>n>>m;ll diff=1;
	    string str,ans="0";
	    unordered_set<string> s;
	    for(i=1;i<m;i++)
	    ans+="1";
	    //cout<<ans;
	    for(i=0;i<n;i++)
	    {
	        cin>>str;
	        s.insert(str);
	       // cout<<str.compare(ans)<<" ";
	        if(str.compare(ans)>0)
	        {
	            diff--;
	            if(diff<0)
	            {
	                ans=prev(ans);
	                diff=1;
	            }
	        }
	        else if(str.compare(ans)<0)
	        {
	            diff++;
	            if(diff>1)
	            {
	                ans=next(ans);
	                diff=0;
	            }
	        }
	        else
	        {
	            while(s.find(ans)!=s.end())
	            {
	                if(diff==0)
	                {
	                     ans=prev(ans);
	                }
	                else
	                {
	                    ans=next(ans);
	                }
	            }
	            diff=(diff+1)%2;
	        }
	    }
	    cout<<ans<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
string prev(string s)
{
    ll i;
    for(i=s.size()-1;i>=0 && s[i]=='0';i--)
    s[i]='1';
    s[i]='0';
    return s;
}

string next(string s)
{
    ll i;
    for(i=s.size()-1;i>=0 && s[i]=='1';i--)
    s[i]='0';
    if(i==-1)
    {
        string one="1";
        s=one+s;
    }
    else
    s[i]='1';
    return s;
}

int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
	    ll n,i,j,k,m,x,y,flag=0;
	    cin>>n>>m;ll diff=1;
	    string str,ans="0";
	    unordered_set<string> s;
	    for(i=1;i<m;i++)
	    ans+="1";
	    //cout<<ans;
	    for(i=0;i<n;i++)
	    {
	        cin>>str;
	        s.insert(str);
	       // cout<<str.compare(ans)<<" ";
	        if(str.compare(ans)>0)
	        {
	            diff--;
	            if(diff<0)
	            {
	                ans=prev(ans);
	                diff=1;
	            }
	        }
	        else if(str.compare(ans)<0)
	        {
	            diff++;
	            if(diff>1)
	            {
	                ans=next(ans);
	                diff=0;
	            }
	        }
	        else
	        {
	            while(s.find(ans)!=s.end())
	            {
	                if(diff==0)
	                {
	                     ans=prev(ans);
	                }
	                else
	                ans=next(ans);
	            }
	        }
	    }
	    cout<<ans<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
string prev(string s)
{
    ll i;
    for(i=s.size()-1;i>=0 && s[i]=='0';i--)
    s[i]='1';
    s[i]='0';
    return s;
}

string next(string s)
{
    ll i;
    for(i=s.size()-1;i>=0 && s[i]=='1';i--)
    s[i]='0';
    if(i==-1)
    {
        string one="1";
        s=one+s;
    }
    else
    s[i]='1';
    return s;
}

int main()
{
	ll t,cnt=0;
	cin>>t;
	while(t--)
	{
	    cnt++;

	    ll n,i,j,k,m,x,y,flag=0;
	    cin>>n>>m;ll diff=1;
	    if(cnt==40)
	    cout<<"dfdfdgfdgfdgf"<<n<<m<<endl;
	    string str,ans="0";
	    unordered_set<string> s;
	    for(i=1;i<m;i++)
	    ans+="1";
	    //cout<<ans;
	    for(i=0;i<n;i++)
	    {
	        cin>>str;
	        if(cnt==40)
	        cout<<str<<endl;
	        s.insert(str);
	       // cout<<str.compare(ans)<<" ";
	        if(str.compare(ans)>0)
	        {
	            diff--;
	            if(diff<0)
	            {
	                ans=prev(ans);
	                diff=1;
	            }
	        }
	        else if(str.compare(ans)<0)
	        {
	            diff++;
	            if(diff>1)
	            {
	                ans=next(ans);
	                diff=0;
	            }
	        }
	        else
	        {
	            while(s.find(ans)!=s.end())
	            {
	                if(diff==0)
	                {
	                     ans=prev(ans);
	                }
	                else
	                {
	                    ans=next(ans);
	                }
	            }
	            diff=(diff+1)%2;
	        }
	    }
	    cout<<ans<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    vector<int> v;
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){

        string s;
        cin>>s;

        int p=0;
        for(int j=0;j<s.size();j++)
        {
            p+=(s[j]-'0')*((1LL<<(s.size()-j-1)));
        }
        v.push_back(p);
    }
    int ans=(1<<m);
    int l=0;
    int h=(1LL<<m)-1;
    int n1=((1LL<<m)-n+1)/2;
    while(l<=h)
    {
        int mid=(l+h)/2;
        int idx=upper_bound(v.begin(),v.end(),mid)-v.begin();
        int c1=mid+1-idx;
        if(c1>=n1)
        {
            if(c1==n1)
            ans=min(ans,mid);
            h=mid-1;
        }
        else      l=mid+1;
    }
    vector<int> v2;
    while(ans!=0)
    {
        v2.push_back(ans%2);
        ans=ans/2;
    }
    while(v2.size()!=m)
    {
        v2.push_back(0);
    }
    for(int i=v2.size()-1;i>=0;i--) cout<<v2[i];cout<<endl;
}
signed main()
{
    int t;
    cin>>t;
    while(t--) solve();
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    vector<int> v;
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){

        string s;
        cin>>s;

        int p=0;
        for(int j=0;j<s.size();j++)
        {
            p+=(s[j]-'0')*((1LL<<(s.size()-j-1)));
        }
        v.push_back(p);
    }
    sort(v.begin(),v.end());
    int ans=(1LL<<m);
    int l=0;
    int h=(1LL<<m)-1;
    int n1=((1LL<<m)-n+1)/2;
    while(l<=h)
    {
        int mid=(l+h)/2;
        int idx=upper_bound(v.begin(),v.end(),mid)-v.begin();
        int c1=mid+1-idx;
        if(c1>=n1)
        {
            if(c1==n1)
            ans=min(ans,mid);
            h=mid-1;
        }
        else      l=mid+1;
    }
    vector<int> v2;
    while(ans!=0)
    {
        v2.push_back(ans%2);
        ans=ans/2;
    }
    while(v2.size()!=m)
    {
        v2.push_back(0);
    }
    for(int i=v2.size()-1;i>=0;i--) cout<<v2[i];cout<<endl;
}
signed main()
{
    int t;
    cin>>t;
    while(t--) solve();
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    vector<int> v;
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){

        string s;
        cin>>s;

        int p=0;
        for(int j=0;j<s.size();j++)
        {
            p+=(s[j]-'0')*((1LL<<(s.size()-j-1)));
        }
        v.push_back(p);
    }
    int ans=0;
    int l=0;
    int h=(1LL<<m)-1;
    int n1=((1LL<<m)-n+1)/2;
    while(l<=h)
    {
        int mid=(l+h)/2;
        int idx=upper_bound(v.begin(),v.end(),mid)-v.begin();
        int c1=mid+1-idx;
        if(c1==n1)
        {
            ans=mid;
            break;
        }
        if(c1<n1) l=mid+1;
        else      h=mid-1;
    }
    vector<int> v2;
    while(ans!=0)
    {
        v2.push_back(ans%2);
        ans=ans/2;
    }
    if(v2.size()==0) cout<<"0\n";
    else
    {
    for(int i=v2.size()-1;i>=0;i--) cout<<v2[i];cout<<endl;
    }
}
signed main()
{
    int t;
    cin>>t;
    while(t--) solve();
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    vector<int> v;
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){

        string s;
        cin>>s;

        int p=0;
        for(int j=0;j<s.size();j++)
        {
            p+=(s[j]-'0')*((1LL<<(s.size()-j-1)));
        }
        v.push_back(p);
    }
    sort(v.begin(),v.end())
    int ans=(1<<m);
    int l=0;
    int h=(1LL<<m)-1;
    int n1=((1LL<<m)-n+1)/2;
    while(l<=h)
    {
        int mid=(l+h)/2;
        int idx=upper_bound(v.begin(),v.end(),mid)-v.begin();
        int c1=mid+1-idx;
        if(c1>=n1)
        {
            if(c1==n1)
            ans=min(ans,mid);
            h=mid-1;
        }
        else      l=mid+1;
    }
    vector<int> v2;
    while(ans!=0)
    {
        v2.push_back(ans%2);
        ans=ans/2;
    }
    while(v2.size()!=m)
    {
        v2.push_back(0);
    }
    for(int i=v2.size()-1;i>=0;i--) cout<<v2[i];cout<<endl;
}
signed main()
{
    int t;
    cin>>t;
    while(t--) solve();
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    vector<int> v;
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){

        string s;
        cin>>s;

        int p=0;
        for(int j=0;j<s.size();j++)
        {
            p+=(s[j]-'0')*((1LL<<(s.size()-j-1)));
        }
        v.push_back(p);
    }
    int ans=0;
    int l=0;
    int h=(1LL<<m)-1;
    int n1=((1LL<<m)-n+1)/2;
    while(l<=h)
    {
        int mid=(l+h)/2;
        int idx=upper_bound(v.begin(),v.end(),mid)-v.begin();
        int c1=mid+1-idx;
        if(c1==n1)
        {
            ans=mid;
            break;
        }
        if(c1<n1) l=mid+1;
        else      h=mid-1;
    }
    vector<int> v2;
    while(ans!=0)
    {
        v2.push_back(ans%2);
        ans=ans/2;
    }
    while(v2.size()!=m)
    {
        v2.push_back(0);
    }
    for(int i=v2.size()-1;i>=0;i--) cout<<v2[i];cout<<endl;
}
signed main()
{
    int t;
    cin>>t;
    while(t--) solve();
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

const int mxN = 2e5+5;

void solve() {
    ll n, m, mid = 1, upper, lower, mini;
    string s;
    vector<ll> vec;
    cin>>n>>m;
    mid = ((1ll<<m) - n - 1)/2;
    while(n--) {
        cin>>s;
        vec.push_back(stoll(s, nullptr, 2));
    }
    sort(vec.begin(), vec.end());
    for(auto u : vec) if(u <= mid) mid++;
    cout<<bitset<64>(mid).to_string().substr(64-m)<<"\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while(T--) {
        solve();
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

const int mxN = 2e5+5;

void solve() {
    ll n, m, mid = 1, upper, lower, mini;
    string s;
    vector<ll> vec;
    set<ll> se;
    cin>>n>>m;
    for(int i=1;i<m;i++) mid *= 2;
    mid -= 1;
    while(n--) {
        cin>>s;
        se.insert(stoll(s, nullptr, 2));
        vec.push_back(stoll(s, nullptr, 2));
    }
    sort(vec.begin(), vec.end());
    lower = upper_bound(vec.begin(), vec.end(), mid) - vec.begin();
    // cout<<lower<<" ";
    upper = (ll)vec.size() - lower;
    mini = min(lower, upper);
    lower -= mini;
    upper -= mini;

    if(upper) {
        upper--;
        while(se.find(mid) != se.end()) mid--;
        while(upper > 0) {
            upper -= 2;
            mid--;
            while(se.find(mid) != se.end()) mid--;
        }
    } else {
        while(se.find(mid) != se.end()) mid--;
        while(lower > 0) {
            lower -= 2;
            mid++;
            while(se.find(mid) != se.end()) mid++;
        }
    }
    int arr[m] = {0}, idx = 0;
    // cout<<mid<<"\n";
    while(mid) arr[idx] = mid % 2, idx++, mid /= 2;
    for(int i=m-1;i>=0;i--) cout<<arr[i];
    cout<<"\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while(T--) {
        solve();
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

const int mxN = 2e5+5;

void solve() {
    ll n, m, mid = 1, upper, lower, mini;
    string s;
    vector<ll> vec;
    set<ll> se;
    cin>>n>>m;
    for(int i=1;i<m;i++) mid *= 2;
    mid -= 1;
    while(n--) {
        cin>>s;
        se.insert(stol(s, nullptr, 2));
        vec.push_back(stol(s, nullptr, 2));
    }
    sort(vec.begin(), vec.end());
    lower = upper_bound(vec.begin(), vec.end(), mid) - vec.begin();
    // cout<<lower<<" ";
    upper = (ll)vec.size() - lower;
    mini = min(lower, upper);
    lower -= mini;
    upper -= mini;

    if(upper) {
        upper--;
        while(upper > 0) {
            upper -= 2;
            mid--;
            while(se.find(mid) != se.end()) mid--;
        }
    } else {
        while(lower > 0) {
            lower -= 2;
            mid++;
            while(se.find(mid) != se.end()) mid++;
        }
        while(se.find(mid) != se.end()) mid--;
    }
    int arr[m] = {0}, idx = 0;
    // cout<<mid<<"\n";
    while(mid) arr[idx] = mid % 2, idx++, mid /= 2;
    for(int i=m-1;i>=0;i--) cout<<arr[i];
    cout<<"\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while(T--) {
        solve();
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

const int mxN = 2e5+5;

void solve() {
    ll n, m, mid = 1, upper, lower, mini;
    string s;
    vector<ll> vec;
    set<ll> se;
    cin>>n>>m;
    for(int i=1;i<m;i++) mid *= 2;
    mid -= 1;
    while(n--) {
        cin>>s;
        se.insert(stol(s, nullptr, 2));
        vec.push_back(stol(s, nullptr, 2));
    }
    sort(vec.begin(), vec.end());
    lower = upper_bound(vec.begin(), vec.end(), mid) - vec.begin();
    // cout<<lower<<" ";
    upper = (ll)vec.size() - lower;
    mini = min(lower, upper);
    lower -= mini;
    upper -= mini;

    if(upper) {
        upper--;
        while(se.find(mid) != se.end()) mid--;
        while(upper > 0) {
            upper -= 2;
            mid--;
            while(se.find(mid) != se.end()) mid--;
        }
    } else {
        while(se.find(mid) != se.end()) mid--;
        while(lower > 0) {
            lower -= 2;
            mid++;
            while(se.find(mid) != se.end()) mid++;
        }
    }
    int arr[m] = {0}, idx = 0;
    // cout<<mid<<"\n";
    while(mid) arr[idx] = mid % 2, idx++, mid /= 2;
    for(int i=m-1;i>=0;i--) cout<<arr[i];
    cout<<"\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while(T--) {
        solve();
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

const int mxN = 2e5+5;

void solve() {
    ll n, m, mid = 1, upper, lower, mini;
    string s;
    vector<ll> vec;
    set<ll> se;
    cin>>n>>m;
    for(int i=1;i<m;i++) mid *= 2;
    mid -= 1;
    while(n--) {
        cin>>s;
        se.insert(stol(s, nullptr, 2));
        vec.push_back(stol(s, nullptr, 2));
    }
    sort(vec.begin(), vec.end());
    lower = upper_bound(vec.begin(), vec.end(), mid) - vec.begin();
    // cout<<lower<<" ";
    upper = (ll)vec.size() - lower;
    mini = min(lower, upper);
    lower -= mini;
    upper -= mini;

    if(upper) {
        upper--;
        while(upper > 0) {
            upper -= 2;
            mid--;
            while(se.find(mid) != se.end()) mid--;
        }
        while(se.find(mid) != se.end()) mid--;
    } else {
        while(lower > 0) {
            lower -= 2;
            mid++;
            while(se.find(mid) != se.end()) mid++;
        }
        while(se.find(mid) != se.end()) mid--;
    }
    int arr[m] = {0}, idx = 0;
    // cout<<mid<<"\n";
    while(mid) arr[idx] = mid % 2, idx++, mid /= 2;
    for(int i=m-1;i>=0;i--) cout<<arr[i];
    cout<<"\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while(T--) {
        solve();
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

const int mxN = 2e5+5;

void solve() {
    ll n, m, lower, diff, tt;
    ll media = 1;
    string s;
    vector<ll> vec;
    set<ll> se;
    cin>>n>>m;
    tt = m;
    while(m--) media *= 2;
    media = media/2 - 1;
    for(int i=0;i<n;i++) {
        cin>>s;
        vec.push_back(stol(s, nullptr, 2));
        se.insert(stol(s, nullptr, 2));
    }
    sort(vec.begin(), vec.end());
    lower = upper_bound(vec.begin(), vec.end(), media) - vec.begin();
    diff =  (ll)vec.size() - 2*lower;
    diff > 0 ? diff++:diff--;
    diff/=2;
    media -= diff;
    ll i;
    if(diff < 0) {
        for(i=media;se.find(i) != se.end();i++);
    } else {
        for(i=media;se.find(i) != se.end();i--);
    }
    i = max(i, 1ll*0);
    int arr[tt] = {0}, idx = 0;
    while(i) arr[idx] = i%2, i/=2, idx++;
    for(int i=tt-1;i>=0;i--) cout<<arr[i];
    cout<<"\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while(T--) {
        solve();
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

const int mxN = 2e5+5;

void solve() {
    ll n, m, lower, diff, tt;
    ll media = 1;
    string s;
    vector<ll> vec;
    set<ll> se;
    cin>>n>>m;
    tt = m;
    while(m--) media *= 2;
    media = media/2 - 1;
    for(int i=0;i<n;i++) {
        cin>>s;
        vec.push_back(stol(s, nullptr, 2));
        se.insert(stol(s, nullptr, 2));
    }
    sort(vec.begin(), vec.end());
    lower = upper_bound(vec.begin(), vec.end(), media) - vec.begin();
    diff =  (ll)vec.size() - 2*lower;
    diff > 0 ? diff++:diff--;
    diff/=2;
    media -= diff;
    ll i;
    if(diff < 0) {
        for(i=media;se.find(i) != se.end();i++);
    } else {
        for(i=media;se.find(i) != se.end();i--);
    }
    i = max(i, 1ll*0);
    int arr[tt] = {0}, idx = 0;
    cout<<i<<" ";
    while(i) arr[idx] = i%2, i/=2, idx++;
    for(int i=tt-1;i>=0;i--) cout<<arr[i];
    cout<<"\n";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
    cin >> T;
    while(T--) {
        solve();
    }
}


#include <bits/stdc++.h>
using namespace std;
const int N = 1e4;
int n,m;
vector<int> v;
int arr[N];
int toDecimal(string s) {
    int a=0;
    for(int i=0, j= m-1; i<m; i++,j--) {
        if(s[j]=='1') {
            a+=(1<<i);
        }
    }
    return a;
}
void toBinary(int aa){
    int de=aa;
    while(de>0){
        v.push_back(de%2);
        de/=2;
    }
    v.push_back(0);
}

int main() {
    int t;
    cin>>t;
    string str;
    int total,ind,temp,k;

    int num=0;
    while(t--) {
        cin>>n>>m;
        for(int i=0; i<n; i++) {
            cin>>str;
            num = toDecimal(str);
            arr[num] = -1;
        }

        total = (1<<m)-n;
        ind = (total-1)/2;
        k=-1;
        for(int i=0; i<(1<<m); i++){
           if(arr[i]==0) k++;
           if(k==ind){
               temp = i;
               break;
           }
        }
        toBinary(temp);
        for(int i=m-1;i>=0;i--){
            cout<<v[i];
        }
        memset(arr, 0, sizeof(arr));
        v.clear();
        cout<<"\n";
    }

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int n,m;
ll toDecimal(string s) {
    ll a=0;
    for(ll i=0, j= m-1; i<m; i++,j--) {
        if(s[j]=='1') {
            a+=(1LL<<i);
        }
    }
    return a;
}
void toBinary(ll aa){
    vector<int> v;
    ll de=aa;
    int cnt=0;
    while(de>0){
        v.push_back(de%2);
        de/=2;
        cnt++;
    }
    for(int i=0; i<m-cnt; i++){
        cout<<0;
    }
    for(int i=v.size()-1; i>=0; i--){
        cout<<v[i];
    }
    cout<<"\n";
}

int main(){
    int t;
    cin>>t;
    while(t--){
        priority_queue <ll,vector<ll>, greater<ll>> q;
        cin>>n>>m;
        string str;
        for(int i=0; i<n; i++){
            cin>>str;
            q.push(toDecimal(str));
        }

        ll mid = ((1<<m)-n-1)/2;
        for(int i=0; i<n; i++){
            if(q.top()<=mid){
                mid++;
                q.pop();
            }
            else break;
        }
        toBinary(mid);
    }
}


#include <bits/stdc++.h>
using namespace std;
int n,m;
int toDecimal(string s) {
    int a=0;
    for(int i=0, j= m-1; i<m; i++,j--) {
        if(s[j]=='1') {
            a+=(1<<i);
        }
    }
    return a;
}
void toBinary(int aa){
    vector<int> v;
    int de=aa;
    int cnt=0;
    while(de>0){
        v.push_back(de%2);
        de/=2;
        cnt++;
    }
    for(int i=0; i<m-cnt; i++){
        cout<<0;
    }
    for(int i=v.size()-1; i>=0; i--){
        cout<<v[i];
    }
    cout<<"\n";
}

int main(){
    int t;
    cin>>t;
    while(t--){
        queue <int> q;
        cin>>n>>m;
        string str;
        for(int i=0; i<n; i++){
            cin>>str;
            q.push(toDecimal(str));
        }

        int mid = ((1<<m)-n-1)/2;
        int cnt=0;
        for(int i=0; i<n; i++){
            if(q.front()<=mid){
                mid++;
                q.pop();
            }
            else break;
        }
        toBinary(mid);

    }
}


#include <bits/stdc++.h>
using namespace std;
const int N = 1e4;
int n,m;
vector<int> v;
int arr[N];
int toDecimal(string s) {
    int a=0;
    for(int i=0, j= m-1; i<m; i++,j--) {
        if(s[j]=='1') {
            a+=(1<<i);
        }
    }
    return a;
}
void toBinary(int aa){
    int de=aa;
    while(de>0){
        v.push_back(de%2);
        de/=2;
    }
    v.push_back(0);
}

int main() {
    int t;
    cin>>t;
    string str;
    int total,ind,temp,k;

    int num=0;
    while(t--) {
        cin>>n>>m;
        for(int i=0; i<n; i++) {
            cin>>str;
            num = toDecimal(str);
            arr[num] = -1;
        }

        total = (1<<m)-n;
        ind = (total-1)/2;
        k=-1;
        for(int i=0; i<(1<<m); i++){
           if(arr[i]==0) k++;
           if(k==ind){
               temp = i;
               break;
           }
        }
        toBinary(temp);
        for(int i=v.size()-1;i>=0;i--){
            cout<<v[i];
        }
        memset(arr, 0, sizeof(arr));
        v.clear();
        cout<<"\n";
    }

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int n,m;
ll toDecimal(string s) {
    ll a=0;
    for(ll i=0, j= m-1; i<m; i++,j--) {
        if(s[j]=='1') {
            a+=(1LL<<i);
        }
    }
    return a;
}
void toBinary(ll aa){
    vector<int> v;
    ll de=aa;
    int cnt=0;
    while(de>0){
        v.push_back(de%2);
        de/=2;
        cnt++;
    }
    for(int i=0; i<m-cnt; i++){
        cout<<0;
    }
    for(int i=v.size()-1; i>=0; i--){
        cout<<v[i];
    }
    cout<<"\n";
}

int main(){
    int t;
    cin>>t;
    while(t--){
        priority_queue <ll,vector<ll>, greater<ll>> q;
        cin>>n>>m;
        string str;
        for(int i=0; i<n; i++){
            cin>>str;
            q.push(toDecimal(str));
        }

        ll mid = ((1LL<<m)-n-1)/2;
        for(int i=0; i<n; i++){
            if(q.top()<=mid){
                mid++;
                q.pop();
            }
            else break;
        }
        toBinary(mid);
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int n,m;
ll toDecimal(string s) {
    ll a=0;
    for(int i=0, j= m-1; i<m; i++,j--) {
        if(s[j]=='1') {
            a+=(1<<i);
        }
    }
    return a;
}
void toBinary(ll aa){
    vector<int> v;
    ll de=aa;
    int cnt=0;
    while(de>0){
        v.push_back(de%2);
        de/=2;
        cnt++;
    }
    for(int i=0; i<m-cnt; i++){
        cout<<0;
    }
    for(int i=v.size()-1; i>=0; i--){
        cout<<v[i];
    }
    cout<<"\n";
}

int main(){
    int t;
    cin>>t;
    while(t--){
        priority_queue <ll,vector<ll>, greater<ll>> q;
        cin>>n>>m;
        string str;
        for(int i=0; i<n; i++){
            cin>>str;
            q.push(toDecimal(str));
        }

        ll mid = ((1<<m)-n-1)/2;
        for(int i=0; i<n; i++){
            if(q.top()<=mid){
                mid++;
                q.pop();
            }
            else break;
        }
        toBinary(mid);
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int n,m;
int toDecimal(string s) {
    int a=0;
    for(int i=0, j= m-1; i<m; i++,j--) {
        if(s[j]=='1') {
            a+=(1<<i);
        }
    }
    return a;
}
void toBinary(ll aa){
    vector<int> v;
    ll de=aa;
    int cnt=0;
    while(de>0){
        v.push_back(de%2);
        de/=2;
        cnt++;
    }
    for(int i=0; i<m-cnt; i++){
        cout<<0;
    }
    for(int i=v.size()-1; i>=0; i--){
        cout<<v[i];
    }
    cout<<"\n";
}

int main(){
    int t;
    cin>>t;
    while(t--){
        priority_queue <int,vector<int>, greater<int>> q;
        cin>>n>>m;
        string str;
        for(int i=0; i<n; i++){
            cin>>str;
            q.push(toDecimal(str));
        }

        ll mid = ((1<<m)-n-1)/2;
        for(int i=0; i<n; i++){
            if(q.top()<=mid){
                mid++;
                q.pop();
            }
            else break;
        }
        toBinary(mid);
    }
}


#include <bits/stdc++.h>
using namespace std;
const int N = 1e4;
int n,m;
vector<int> v;
int toDecimal(string s) {
    int a=0;
    for(int i=0, j= m-1; i<m; i++,j--) {
        if(s[j]=='1') {
            a+=(1<<i);
        }
    }
    return a;
}
void toBinary(int aa){
    int de=aa;
    while(de>0){
        v.push_back(de%2);
        de/=2;
    }
    v.push_back(0);
}

int main() {
    int t;
    cin>>t;
    string str;
    int total,ind,temp,k;
    int arr[N];
    int num=0;
    while(t--) {
        cin>>n>>m;
        for(int i=0; i<n; i++) {
            cin>>str;
            num = toDecimal(str);
            arr[num] = -1;
        }

        total = (1<<m)-n;
        ind = (total-1)/2;
        k=-1;
        for(int i=0; i<(1<<m); i++){
           if(arr[i]==0) k++;
           if(k==ind){
               temp = i;
               break;
           }
        }
        toBinary(temp);
        for(int i=v.size()-1;i>=0;i--){
            cout<<v[i];
        }
        memset(arr, 0, sizeof(arr));
        v.clear();
        cout<<"\n";
    }

}


#include <bits/stdc++.h>
using namespace std;
int n,m;
int toDecimal(string s) {
    int a=0;
    for(int i=0, j= m-1; i<m; i++,j--) {
        if(s[j]=='1') {
            a+=(1<<i);
        }
    }
    return a;
}
void toBinary(int aa){
    vector<int> v;
    int de=aa;
    int cnt=0;
    while(de>0){
        v.push_back(de%2);
        de/=2;
        cnt++;
    }
    for(int i=0; i<m-cnt; i++){
        cout<<0;
    }
    for(int i=v.size()-1; i>=0; i--){
        cout<<v[i];
    }
    cout<<"\n";
}

int main(){
    int t;
    cin>>t;
    while(t--){
        priority_queue <int,vector<int>, greater<int>> q;
        cin>>n>>m;
        string str;
        for(int i=0; i<n; i++){
            cin>>str;
            q.push(toDecimal(str));
        }

        int mid = ((1<<m)-n-1)/2;
        for(int i=0; i<n; i++){
            if(q.top()<=mid){
                mid++;
                q.pop();
            }
            else break;
        }
        toBinary(mid);
    }
}


#include<bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#define    boost        ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define    nl           "\n"
#define    ll           long long
#define    pb           push_back
#define    mpr          make_pair
#define    fr(i,a,n)    for(ll i=a;i<n;++i)
#define    fr0(i,n)     for(ll i=0;i<n;++i)
#define    pii          pair<int, int>

void fio()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
	double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
	time_taken *= 1e-9;
	cout << "\nExecuted in: " << fixed
	     << time_taken << setprecision(9);
	cout << " sec";
#endif
}

///----------------------------- | FUNCTIONS | --------------------------------------///

//sort(v.begin(), v.end(), sortbysec);
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b)
{
	return (a.second < b.second);
}

// MODULAR EXPONENTION (logN) (pow(x,y)%p)
ll modexp(ll x, ll y, ll p)
{
	ll res = 1;
	x = x % p;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}

// Find smallest divisior
int smallestDivisor(int n)
{
	if (n % 2 == 0)
		return 2;
	for (int i = 3; i * i <= n; i += 2)
	{
		if (n % i == 0)
			return i;
	}
	return n;
}

bool isPrime(int n)
{
	// Corner case
	if (n <= 1)
		return false;

	// Check from 2 to n-1
	for (int i = 2; i < n; i++)
		if (n % i == 0)
			return false;

	return true;
}

const int N = 2e5 + 5;
/*
vector<ll> adj[N];
bool visited[N];

ll a[N], b[N], c[N];

ll ans = 0;

ll remg[2];

void dfs(ll v)
{
	ll rem[2] = {0, 0};
	if (b[v] != c[v])
	{
		rem[c[v]]++;
	}
	visited[v] = true;
	for (ll u : adj[v])
	{
		if (!visited[u])
		{
			a[u] = min(a[u], a[v]);
			dfs(u);
			rem[0] += remg[0];
			rem[1] += remg[1];
		}
	}
	ll mn = min(rem[0], rem[1]);
	rem[0] -= mn; rem[1] -= mn;
	ans += a[v] * mn;
	remg[0] = rem[0]; remg[1] = rem[1];
}
*/

// left shift << multiply by 2
// right shift >> divide by 2

///----------------------------- | START FROM HERE | --------------------------------------///

void solve()
{
	ll n, m; cin >> n >> m;
	ll temp = m;

	bitset<61> b; vector<unsigned long long int> a;
	fr0(i, n)
	{
		cin >> b;
		a.pb(b.to_ullong());
	}
	sort(a.begin(), a.end());
	unsigned long long int p = 1;
	while (m--) p *= 2;
	p = p - n - 1;
	p = p / 2;
	fr0(i, n) if (p >= a[i]) p++;
	bitset<61> ans(p);
	while (temp--) cout << ans[temp];
	cout << nl;
	a.clear();

}

int main()
{
	auto start = chrono::high_resolution_clock::now();
	boost;
	fio();
	int t;
	t = 1;
	cin >> t;
	while (t--)
	{
		solve();
	}
	auto end = chrono::high_resolution_clock::now();
	TIME(start, end);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#define    boost        ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define    nl           "\n"
#define    ll           long long
#define    pb           push_back
#define    mpr          make_pair
#define    fr(i,a,n)    for(ll i=a;i<n;++i)
#define    fr0(i,n)     for(ll i=0;i<n;++i)
#define    pii          pair<int, int>

void fio()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
	double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
	time_taken *= 1e-9;
	cout << "\nExecuted in: " << fixed
	     << time_taken << setprecision(9);
	cout << " sec";
#endif
}

///----------------------------- | FUNCTIONS | --------------------------------------///

//sort(v.begin(), v.end(), sortbysec);
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b)
{
	return (a.second < b.second);
}

// MODULAR EXPONENTION (logN) (pow(x,y)%p)
ll modexp(ll x, ll y, ll p)
{
	ll res = 1;
	x = x % p;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}

// Find smallest divisior
int smallestDivisor(int n)
{
	if (n % 2 == 0)
		return 2;
	for (int i = 3; i * i <= n; i += 2)
	{
		if (n % i == 0)
			return i;
	}
	return n;
}

bool isPrime(int n)
{
	// Corner case
	if (n <= 1)
		return false;

	// Check from 2 to n-1
	for (int i = 2; i < n; i++)
		if (n % i == 0)
			return false;

	return true;
}

const int N = 2e5 + 5;
/*
vector<ll> adj[N];
bool visited[N];

ll a[N], b[N], c[N];

ll ans = 0;

ll remg[2];

void dfs(ll v)
{
	ll rem[2] = {0, 0};
	if (b[v] != c[v])
	{
		rem[c[v]]++;
	}
	visited[v] = true;
	for (ll u : adj[v])
	{
		if (!visited[u])
		{
			a[u] = min(a[u], a[v]);
			dfs(u);
			rem[0] += remg[0];
			rem[1] += remg[1];
		}
	}
	ll mn = min(rem[0], rem[1]);
	rem[0] -= mn; rem[1] -= mn;
	ans += a[v] * mn;
	remg[0] = rem[0]; remg[1] = rem[1];
}
*/

// left shift << multiply by 2
// right shift >> divide by 2

///----------------------------- | START FROM HERE | --------------------------------------///

void solve()
{
	int n, m; cin >> n >> m;
	int temp = m;
	bitset<61> b; double a[n];
	fr0(i, n)
	{
		cin >> b;
		a[i] = b.to_ulong();
	}
	sort(a, a + n);
	double p = 1;;
	while (m--) p *= 2;
	p = p - n - 1;
	p = p / 2;
	fr0(i, n) if (p >= a[i]) p++;
	bitset<61> ans(p);
	while (temp--) cout << ans[temp];
	cout << nl;

}

int main()
{
	auto start = chrono::high_resolution_clock::now();
	boost;
	fio();
	int t;
	t = 1;
	cin >> t;
	while (t--)
	{
		solve();
	}
	auto end = chrono::high_resolution_clock::now();
	TIME(start, end);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#define    boost        ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define    nl           "\n"
#define    ll           long long
#define    pb           push_back
#define    mpr          make_pair
#define    fr(i,a,n)    for(ll i=a;i<n;++i)
#define    fr0(i,n)     for(ll i=0;i<n;++i)
#define    pii          pair<int, int>

void fio()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
	double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
	time_taken *= 1e-9;
	cout << "\nExecuted in: " << fixed
	     << time_taken << setprecision(9);
	cout << " sec";
#endif
}

///----------------------------- | FUNCTIONS | --------------------------------------///

//sort(v.begin(), v.end(), sortbysec);
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b)
{
	return (a.second < b.second);
}

// MODULAR EXPONENTION (logN) (pow(x,y)%p)
ll modexp(ll x, ll y, ll p)
{
	ll res = 1;
	x = x % p;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}

// Find smallest divisior
int smallestDivisor(int n)
{
	if (n % 2 == 0)
		return 2;
	for (int i = 3; i * i <= n; i += 2)
	{
		if (n % i == 0)
			return i;
	}
	return n;
}

bool isPrime(int n)
{
	// Corner case
	if (n <= 1)
		return false;

	// Check from 2 to n-1
	for (int i = 2; i < n; i++)
		if (n % i == 0)
			return false;

	return true;
}

const int N = 2e5 + 5;
/*
vector<ll> adj[N];
bool visited[N];

ll a[N], b[N], c[N];

ll ans = 0;

ll remg[2];

void dfs(ll v)
{
	ll rem[2] = {0, 0};
	if (b[v] != c[v])
	{
		rem[c[v]]++;
	}
	visited[v] = true;
	for (ll u : adj[v])
	{
		if (!visited[u])
		{
			a[u] = min(a[u], a[v]);
			dfs(u);
			rem[0] += remg[0];
			rem[1] += remg[1];
		}
	}
	ll mn = min(rem[0], rem[1]);
	rem[0] -= mn; rem[1] -= mn;
	ans += a[v] * mn;
	remg[0] = rem[0]; remg[1] = rem[1];
}
*/

// left shift << multiply by 2
// right shift >> divide by 2

///----------------------------- | START FROM HERE | --------------------------------------///

void solve()
{
	int n, m; cin >> n >> m;
	int temp = m;
	bitset<61> b; vector<unsigned long long int> a;
	fr0(i, n)
	{
		cin >> b;
		a.pb((unsigned long long int)b.to_ulong());
	}
	sort(a.begin(), a.end());
	unsigned long long int p = 1;
	while (m--) p *= 2;
	p = p - n - 1;
	p = p / 2;
	fr0(i, n) if (p >= a[i]) p++;
	bitset<61> ans(p);
	while (temp--) cout << ans[temp];
	cout << nl;
	a.clear();

}

int main()
{
	auto start = chrono::high_resolution_clock::now();
	boost;
	fio();
	int t;
	t = 1;
	cin >> t;
	while (t--)
	{
		solve();
	}
	auto end = chrono::high_resolution_clock::now();
	TIME(start, end);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#define    boost        ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define    nl           "\n"
#define    ll           long long
#define    pb           push_back
#define    mpr          make_pair
#define    fr(i,a,n)    for(ll i=a;i<n;++i)
#define    fr0(i,n)     for(ll i=0;i<n;++i)
#define    pii          pair<int, int>

void fio()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
	double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
	time_taken *= 1e-9;
	cout << "\nExecuted in: " << fixed
	     << time_taken << setprecision(9);
	cout << " sec";
#endif
}

///----------------------------- | FUNCTIONS | --------------------------------------///

//sort(v.begin(), v.end(), sortbysec);
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b)
{
	return (a.second < b.second);
}

// MODULAR EXPONENTION (logN) (pow(x,y)%p)
ll modexp(ll x, ll y, ll p)
{
	ll res = 1;
	x = x % p;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}

// Find smallest divisior
int smallestDivisor(int n)
{
	if (n % 2 == 0)
		return 2;
	for (int i = 3; i * i <= n; i += 2)
	{
		if (n % i == 0)
			return i;
	}
	return n;
}

bool isPrime(int n)
{
	// Corner case
	if (n <= 1)
		return false;

	// Check from 2 to n-1
	for (int i = 2; i < n; i++)
		if (n % i == 0)
			return false;

	return true;
}

const int N = 2e5 + 5;
/*
vector<ll> adj[N];
bool visited[N];

ll a[N], b[N], c[N];

ll ans = 0;

ll remg[2];

void dfs(ll v)
{
	ll rem[2] = {0, 0};
	if (b[v] != c[v])
	{
		rem[c[v]]++;
	}
	visited[v] = true;
	for (ll u : adj[v])
	{
		if (!visited[u])
		{
			a[u] = min(a[u], a[v]);
			dfs(u);
			rem[0] += remg[0];
			rem[1] += remg[1];
		}
	}
	ll mn = min(rem[0], rem[1]);
	rem[0] -= mn; rem[1] -= mn;
	ans += a[v] * mn;
	remg[0] = rem[0]; remg[1] = rem[1];
}
*/

// left shift << multiply by 2
// right shift >> divide by 2

///----------------------------- | START FROM HERE | --------------------------------------///

void solve()
{
	int n, m; cin >> n >> m;
	int temp = m;
	bitset<60> b; unsigned long long int a[n];
	fr0(i, n)
	{
		cin >> b;
		a[i] = b.to_ulong();
	}
	sort(a, a + n);
	unsigned long long int p = 1;;
	while (m--) p *= 2;
	p = p - n - 1;
	p = p / 2;
	fr0(i, n) if (p >= a[i]) p++;
	bitset<60> ans(p);
	while (temp--) cout << ans[temp];
	cout << nl;

}

int main()
{
	auto start = chrono::high_resolution_clock::now();
	boost;
	fio();
	int t;
	t = 1;
	cin >> t;
	while (t--)
	{
		solve();
	}
	auto end = chrono::high_resolution_clock::now();
	TIME(start, end);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#define    boost        ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define    nl           "\n"
#define    ll           long long
#define    pb           push_back
#define    mpr          make_pair
#define    fr(i,a,n)    for(ll i=a;i<n;++i)
#define    fr0(i,n)     for(ll i=0;i<n;++i)
#define    pii          pair<int, int>

void fio()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
	double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
	time_taken *= 1e-9;
	cout << "\nExecuted in: " << fixed
	     << time_taken << setprecision(9);
	cout << " sec";
#endif
}

///----------------------------- | FUNCTIONS | --------------------------------------///

//sort(v.begin(), v.end(), sortbysec);
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b)
{
	return (a.second < b.second);
}

// MODULAR EXPONENTION (logN) (pow(x,y)%p)
ll modexp(ll x, ll y, ll p)
{
	ll res = 1;
	x = x % p;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}

// Find smallest divisior
int smallestDivisor(int n)
{
	if (n % 2 == 0)
		return 2;
	for (int i = 3; i * i <= n; i += 2)
	{
		if (n % i == 0)
			return i;
	}
	return n;
}

bool isPrime(int n)
{
	// Corner case
	if (n <= 1)
		return false;

	// Check from 2 to n-1
	for (int i = 2; i < n; i++)
		if (n % i == 0)
			return false;

	return true;
}

const int N = 2e5 + 5;
/*
vector<ll> adj[N];
bool visited[N];

ll a[N], b[N], c[N];

ll ans = 0;

ll remg[2];

void dfs(ll v)
{
	ll rem[2] = {0, 0};
	if (b[v] != c[v])
	{
		rem[c[v]]++;
	}
	visited[v] = true;
	for (ll u : adj[v])
	{
		if (!visited[u])
		{
			a[u] = min(a[u], a[v]);
			dfs(u);
			rem[0] += remg[0];
			rem[1] += remg[1];
		}
	}
	ll mn = min(rem[0], rem[1]);
	rem[0] -= mn; rem[1] -= mn;
	ans += a[v] * mn;
	remg[0] = rem[0]; remg[1] = rem[1];
}
*/

// left shift << multiply by 2
// right shift >> divide by 2

///----------------------------- | START FROM HERE | --------------------------------------///

void solve()
{
	int n, m; cin >> n >> m;
	int temp = m;
	bitset<61> b; unsigned long long int a[n];
	fr0(i, n)
	{
		cin >> b;
		a[i] = b.to_ulong();
	}
	sort(a, a + n);
	unsigned long long int p = 1;;
	while (m--) p *= 2;
	p = p - n - 1;
	p = p / 2;
	fr0(i, n) if (p >= a[i]) p++;
	bitset<61> ans(p);
	while (temp--) cout << ans[temp];
	cout << nl;

}

int main()
{
	auto start = chrono::high_resolution_clock::now();
	boost;
	fio();
	int t;
	t = 1;
	cin >> t;
	while (t--)
	{
		solve();
	}
	auto end = chrono::high_resolution_clock::now();
	TIME(start, end);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#define    boost        ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define    nl           "\n"
#define    ll           long long
#define    pb           push_back
#define    mpr          make_pair
#define    fr(i,a,n)    for(ll i=a;i<n;++i)
#define    fr0(i,n)     for(ll i=0;i<n;++i)
#define    pii          pair<int, int>

void fio()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
	double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
	time_taken *= 1e-9;
	cout << "\nExecuted in: " << fixed
	     << time_taken << setprecision(9);
	cout << " sec";
#endif
}

///----------------------------- | FUNCTIONS | --------------------------------------///

//sort(v.begin(), v.end(), sortbysec);
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b)
{
	return (a.second < b.second);
}

// MODULAR EXPONENTION (logN) (pow(x,y)%p)
ll modexp(ll x, ll y, ll p)
{
	ll res = 1;
	x = x % p;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}

// Find smallest divisior
int smallestDivisor(int n)
{
	if (n % 2 == 0)
		return 2;
	for (int i = 3; i * i <= n; i += 2)
	{
		if (n % i == 0)
			return i;
	}
	return n;
}

bool isPrime(int n)
{
	// Corner case
	if (n <= 1)
		return false;

	// Check from 2 to n-1
	for (int i = 2; i < n; i++)
		if (n % i == 0)
			return false;

	return true;
}

const int N = 2e5 + 5;
/*
vector<ll> adj[N];
bool visited[N];

ll a[N], b[N], c[N];

ll ans = 0;

ll remg[2];

void dfs(ll v)
{
	ll rem[2] = {0, 0};
	if (b[v] != c[v])
	{
		rem[c[v]]++;
	}
	visited[v] = true;
	for (ll u : adj[v])
	{
		if (!visited[u])
		{
			a[u] = min(a[u], a[v]);
			dfs(u);
			rem[0] += remg[0];
			rem[1] += remg[1];
		}
	}
	ll mn = min(rem[0], rem[1]);
	rem[0] -= mn; rem[1] -= mn;
	ans += a[v] * mn;
	remg[0] = rem[0]; remg[1] = rem[1];
}
*/

// left shift << multiply by 2
// right shift >> divide by 2

///----------------------------- | START FROM HERE | --------------------------------------///

void solve()
{
	ll n, m; cin >> n >> m;
	bitset<60> b;
	vector<unsigned long long int> a;
	fr0(i, n)
	{
		cin >> b;
		a.pb(b.to_ullong());
	}
	sort(a.begin(), a.end());
	unsigned long long int p = 1;
	fr0(i, m) p *= 2;
	p = p - n - 1;
	p = p / 2;
	fr0(i, n) if (p >= a[i]) p++;
	bitset<60> ans(p);
	while (m--) cout << ans[m];
	cout << nl;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();
	boost;
	fio();
	int t;
	t = 1;
	cin >> t;
	while (t--)
	{
		solve();
	}
	auto end = chrono::high_resolution_clock::now();
	TIME(start, end);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#define    boost        ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define    nl           "\n"
#define    ll           long long
#define    pb           push_back
#define    mpr          make_pair
#define    fr(i,a,n)    for(ll i=a;i<n;++i)
#define    fr0(i,n)     for(ll i=0;i<n;++i)
#define    pii          pair<int, int>

void fio()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
	double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
	time_taken *= 1e-9;
	cout << "\nExecuted in: " << fixed
	     << time_taken << setprecision(9);
	cout << " sec";
#endif
}

///----------------------------- | FUNCTIONS | --------------------------------------///

//sort(v.begin(), v.end(), sortbysec);
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b)
{
	return (a.second < b.second);
}

// MODULAR EXPONENTION (logN) (pow(x,y)%p)
ll modexp(ll x, ll y, ll p)
{
	ll res = 1;
	x = x % p;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}

// Find smallest divisior
int smallestDivisor(int n)
{
	if (n % 2 == 0)
		return 2;
	for (int i = 3; i * i <= n; i += 2)
	{
		if (n % i == 0)
			return i;
	}
	return n;
}

bool isPrime(int n)
{
	// Corner case
	if (n <= 1)
		return false;

	// Check from 2 to n-1
	for (int i = 2; i < n; i++)
		if (n % i == 0)
			return false;

	return true;
}

const int N = 2e5 + 5;
/*
vector<ll> adj[N];
bool visited[N];

ll a[N], b[N], c[N];

ll ans = 0;

ll remg[2];

void dfs(ll v)
{
	ll rem[2] = {0, 0};
	if (b[v] != c[v])
	{
		rem[c[v]]++;
	}
	visited[v] = true;
	for (ll u : adj[v])
	{
		if (!visited[u])
		{
			a[u] = min(a[u], a[v]);
			dfs(u);
			rem[0] += remg[0];
			rem[1] += remg[1];
		}
	}
	ll mn = min(rem[0], rem[1]);
	rem[0] -= mn; rem[1] -= mn;
	ans += a[v] * mn;
	remg[0] = rem[0]; remg[1] = rem[1];
}
*/

// left shift << multiply by 2
// right shift >> divide by 2

///----------------------------- | START FROM HERE | --------------------------------------///

void solve()
{
	int n, m; cin >> n >> m;
	int temp = m;
	bitset<60> b; vector<double> a;
	fr0(i, n)
	{
		cin >> b;
		a.pb(b.to_ulong());
	}
	sort(a.begin(), a.end());
	double p = 1;
	while (m--) p *= 2;
	p = p - n - 1;
	p = p / 2;
	fr0(i, n) if (p >= a[i]) p++;
	bitset<60> ans(p);
	while (temp--) cout << ans[temp];
	cout << nl;

}

int main()
{
	auto start = chrono::high_resolution_clock::now();
	boost;
	fio();
	int t;
	t = 1;
	cin >> t;
	while (t--)
	{
		solve();
	}
	auto end = chrono::high_resolution_clock::now();
	TIME(start, end);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#define    boost        ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define    nl           "\n"
#define    ll           long long
#define    pb           push_back
#define    mpr          make_pair
#define    fr(i,a,n)    for(ll i=a;i<n;++i)
#define    fr0(i,n)     for(ll i=0;i<n;++i)
#define    pii          pair<int, int>

void fio()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
	double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
	time_taken *= 1e-9;
	cout << "\nExecuted in: " << fixed
	     << time_taken << setprecision(9);
	cout << " sec";
#endif
}

///----------------------------- | FUNCTIONS | --------------------------------------///

//sort(v.begin(), v.end(), sortbysec);
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b)
{
	return (a.second < b.second);
}

// MODULAR EXPONENTION (logN) (pow(x,y)%p)
ll modexp(ll x, ll y, ll p)
{
	ll res = 1;
	x = x % p;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1) res = (res * x) % p;
		y = y >> 1;
		x = (x * x) % p;
	}
	return res;
}

// Find smallest divisior
int smallestDivisor(int n)
{
	if (n % 2 == 0)
		return 2;
	for (int i = 3; i * i <= n; i += 2)
	{
		if (n % i == 0)
			return i;
	}
	return n;
}

bool isPrime(int n)
{
	// Corner case
	if (n <= 1)
		return false;

	// Check from 2 to n-1
	for (int i = 2; i < n; i++)
		if (n % i == 0)
			return false;

	return true;
}

const int N = 2e5 + 5;
/*
vector<ll> adj[N];
bool visited[N];

ll a[N], b[N], c[N];

ll ans = 0;

ll remg[2];

void dfs(ll v)
{
	ll rem[2] = {0, 0};
	if (b[v] != c[v])
	{
		rem[c[v]]++;
	}
	visited[v] = true;
	for (ll u : adj[v])
	{
		if (!visited[u])
		{
			a[u] = min(a[u], a[v]);
			dfs(u);
			rem[0] += remg[0];
			rem[1] += remg[1];
		}
	}
	ll mn = min(rem[0], rem[1]);
	rem[0] -= mn; rem[1] -= mn;
	ans += a[v] * mn;
	remg[0] = rem[0]; remg[1] = rem[1];
}
*/

// left shift << multiply by 2
// right shift >> divide by 2

///----------------------------- | START FROM HERE | --------------------------------------///

void solve()
{
	int n, m; cin >> n >> m;
	int temp = m;
	bitset<61> b; vector<double> a;
	fr0(i, n)
	{
		cin >> b;
		a.pb(b.to_ulong());
	}
	sort(a.begin(), a.end());
	double p = 1;
	while (m--) p *= 2;
	p = p - n - 1;
	p = p / 2;
	fr0(i, n) if (p >= a[i]) p++;
	bitset<61> ans(p);
	while (temp--) cout << ans[temp];
	cout << nl;

}

int main()
{
	auto start = chrono::high_resolution_clock::now();
	boost;
	fio();
	int t;
	t = 1;
	cin >> t;
	while (t--)
	{
		solve();
	}
	auto end = chrono::high_resolution_clock::now();
	TIME(start, end);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int> >
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type* arr = new type[n];
#define forn(i, n) for (int i = 1; i <= n; i++)
#define me0(x) memset(x, 0, sizeof(x))
#define me1(x) memset(x, -1, sizeof(x))
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
const int N = 2e5 + 4;
void run() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int n, m;
string s;
int solve() {
    cin >> n >> m;
    int ans = ((1LL << m) - 1) / 2, temp, f = 0;
    map<int, int> ms;
    forn(i, n) {
    	f = 1- f;
        cin >> s;
        temp = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s[i] - '0') {
                temp += (1LL << (m - i - 1));
            }
        }
        ms[temp]++;
        if (f) {
            //even
            if (temp > ans) continue;
            int t = ans + 1;
            while (ms[t]) {
                t++;
            }
            ans = t;

        } else {
            //odd
            if (temp < ans) continue;
            int t = ans - 1;
            while (ms[t]) {
                t--;
            }
            ans = t;
        }
    }
    return ans;
}
int32_t main() {
    run();
	w(t) {
        bitset<62> b(solve());
        for(int i=m-1;i>=0;i--) cout<<b[i];
        cout<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int> >
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type* arr = new type[n];
#define forn(i, n) for (int i = 1; i <= n; i++)
#define me0(x) memset(x, 0, sizeof(x))
#define me1(x) memset(x, -1, sizeof(x))
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
const int N = 2e5 + 4;
void run() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int64_t n, m;
string s;
int64_t solve() {
    cin >> n >> m;
    int64_t ans = ((1 << m) - 1) / 2, temp, f = 0;
    map<int64_t, int64_t> ms;
    forn(i, n) {
    	f = 1- f;
        cin >> s;
        temp = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s[i] - '0') {
                temp += (1 << (m - i - 1));
            }
        }
        ms[temp]++;
        if (f) {
            //even
            if (temp > ans) continue;
            int t = ans + 1;
            while (ms[t]) {
                t++;
            }
            ans = t;

        } else {
            //odd
            if (temp < ans) continue;
            int t = ans - 1;
            while (ms[t]) {
                t--;
            }
            ans = t;
        }
    }
    return ans;
}
int32_t main() {
    run();
    w(t) {
        int64_t ans = solve();
        string a = "";
        while (ans) {
            if (ans & 1)
                a += '1';
            else
                a += '0';
            ans >>= 1;
        }
        while(a.length() < m) a += '0';
        reverse(a.begin(), a.end());
        cout << a << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int> >
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type* arr = new type[n];
#define forn(i, n) for (int i = 1; i <= n; i++)
#define me0(x) memset(x, 0, sizeof(x))
#define me1(x) memset(x, -1, sizeof(x))
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
const int N = 2e5 + 4;
void run() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int n, m;
string s;
int solve() {
    cin >> n >> m;
    int ans = ((1 << m) - 1) / 2, temp, f = 0;
    map<int, int> ms;
    forn(i, n) {
    	f = 1- f;
        cin >> s;
        temp = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s[i] - '0') {
                temp += (1 << (m - i - 1));
            }
        }
        ms[temp]++;
        if (f) {
            //even
            if (temp > ans) continue;
            int t = ans + 1;
            while (ms[t]) {
                t++;
            }
            ans = t;

        } else {
            //odd
            if (temp < ans) continue;
            int t = ans - 1;
            while (ms[t]) {
                t--;
            }
            ans = t;
        }
    }
    return ans;
}
int32_t main() {
    run();
    w(t) {
        int ans = solve();
        string a = "";
        while (ans) {
            if (ans & 1)
                a += '1';
            else
                a += '0';
            ans >>= 1;
        }
        while(a.length() < m) a += '0';
        reverse(a.begin(), a.end());
        cout << a << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int> >
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type* arr = new type[n];
#define forn(i, n) for (int i = 1; i <= n; i++)
#define me0(x) memset(x, 0, sizeof(x))
#define me1(x) memset(x, -1, sizeof(x))
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
const int N = 2e5 + 4;
void run() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int n, m;
string s;
int solve() {
    cin >> n >> m;
    int ans = ((1LL << m) - 1) / 2, temp, f = 0;
    map<int, int> ms;
    forn(i, n) {
    	f = 1- f;
        cin >> s;
        temp = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s[i] - '0') {
                temp += (1LL << (m - i - 1));
            }
        }
        ms[temp]++;
        if (f) {
            //even
            if (temp > ans) continue;
            int t = ans + 1;
            while (ms[t]) {
                t++;
            }
            ans = t;

        } else {
            //odd
            if (temp < ans) continue;
            int t = ans - 1;
            while (ms[t]) {
                t--;
            }
            ans = t;
        }
    }
    return ans;
}
int32_t main() {
    run();
	w(t) {
        int ans = solve();
        string a = "";
        while (ans) {
            if (ans & 1)
                a += '1';
            else
                a += '0';
            ans >>= 1LL;
        }
        while(a.length() < m) a += '0';
        reverse(a.begin(), a.end());
        cout << a << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int> >
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type* arr = new type[n];
#define forn(i, n) for (int i = 1; i <= n; i++)
#define me0(x) memset(x, 0, sizeof(x))
#define me1(x) memset(x, -1, sizeof(x))
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
const int N = 2e5 + 4;
void run() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int64_t n, m;
string s;
int64_t solve() {
    cin >> n >> m;
    int64_t ans = ((1 << m) - 1) / 2, temp, f = 0;
    map<int, int> ms;
    forn(i, n) {
    	f = 1- f;
        cin >> s;
        temp = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s[i] - '0') {
                temp += (1 << (m - i - 1));
            }
        }
        ms[temp]++;
        if (f) {
            //even
            if (temp > ans) continue;
            int t = ans + 1;
            while (ms[t]) {
                t++;
            }
            ans = t;

        } else {
            //odd
            if (temp < ans) continue;
            int t = ans - 1;
            while (ms[t]) {
                t--;
            }
            ans = t;
        }
    }
    return ans;
}
int32_t main() {
    run();
    w(t) {
        int64_t ans = solve();
        string a = "";
        while (ans) {
            if (ans & 1)
                a += '1';
            else
                a += '0';
            ans >>= 1;
        }
        while(a.length() < m) a += '0';
        reverse(a.begin(), a.end());
        cout << a << "\n";
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define N 1e6
using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
#define  setp setprecision(10)
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef unsigned long long int  uint64;
set<ll> vis;

ll binaryToDecimal(string n)
{
    string num = n;
    ll dec_value = 0;

    // Initializing base value to 1, i.e 2^0
    ll base = 1;

    int len = num.length();
    for (int i = len - 1; i >= 0; i--) {
        if (num[i] == '1')
            dec_value += base;
        base = base * 2;
    }

    return dec_value;
}

void moveleft(ll &median){
	median--;
	while(vis.find(median) != vis.end()){
		median--;
	}

}
void moveRight(ll &median){
	median++;
	while(vis.find(median) != vis.end()){
		median++;
	}

}

int main(){
 #ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);
 freopen("output.txt", "w", stdout);
 #endif
ios_base::sync_with_stdio(false); cin.tie(0);
int t;
cin>>t;
while(t--){
	vis.clear();
	int n, m;
	cin>>n>>m;
	vector<ll> tBR;
	FOR(i, 0, n, 1){
		string x;
		cin>>x;
		ll cI = binaryToDecimal(x);

		tBR.PB(cI);

	}

	ll len = 1LL<<m;
	ll median = (1LL<<(m-1)) - 1;

	FOR(i, 0, n, 1){
		ll cV = tBR[i];

		if(cV == median){
			if(len%2 == 0){
				moveRight(median);
			}
			else{
				moveleft(median);
			}

		}
		else if(cV< median){
			if(len%2 == 0){
				moveRight(median);
			}

		}
		else{
			if(len%2 != 0){
				moveleft(median);
			}

		}

		vis.insert(cV);
		len--;
	}

	string aS = std::bitset<60>(median).to_string();
	 cout<< aS.substr(60-m, m)<< endl;

	/*	string aS = std::bitset<60>(median).to_string();
	 cout<< aS.substr(60-m, m)<< endl;*/

}
}


#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define N 1e6
using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
#define  setp setprecision(10)
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef unsigned long long int  uint64;
set<ll> vis;

ll binaryToDecimal(string n)
{
    string num = n;
    ll dec_value = 0;

    // Initializing base value to 1, i.e 2^0
    ll base = 1;

    int len = num.length();
    for (int i = len - 1; i >= 0; i--) {
        if (num[i] == '1')
            dec_value += base;
        base = base * 2;
    }

    return dec_value;
}

void moveleft(ll &median){
	median--;
	while(vis.find(median) != vis.end()){
		median--;
	}

}
void moveRight(ll &median){
	median++;
	while(vis.find(median) != vis.end()){
		median++;
	}

}

int main(){
 #ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);
 freopen("output.txt", "w", stdout);
 #endif
ios_base::sync_with_stdio(false); cin.tie(0);
int t;
cin>>t;
while(t--){
	vis.clear();
	int n, m;
	cin>>n>>m;
	vector<ll> tBR;
	FOR(i, 0, n, 1){
		string x;
		cin>>x;
		ll cI = binaryToDecimal(x);

		tBR.PB(cI);

	}

	ll len = 1LL<<m;
	ll median = (1LL<<(m-1)) - 1;

	FOR(i, 0, n, 1){
		ll cV = tBR[i];

		if(cV == median){
			if(len%2 == 0){
				moveRight(median);
			}
			else{
				moveleft(median);
			}

		}
		else if(cV< median){
			if(len%2 == 0){
				moveRight(median);
			}

		}
		else{
			if(len%2 != 0){
				moveleft(median);
			}

		}

		vis.insert(cV);
		len--;
	}

	string res ="";

	while(median){
		res += median&1 ? "1" : "0";
		median >>= 1;
	}

	while(res.length()< m){
		res+= "0";
	}
	reverse(all(res));
	cout<< res<< endl;

	/*	string aS = std::bitset<60>(median).to_string();
	 cout<< aS.substr(60-m, m)<< endl;*/

}
}


#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define N 1e6
using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
#define  setp setprecision(10)
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef unsigned long long int  uint64;
 void decToBinary(int n)
{
    // array to store binary number
    int binaryNum[32];

    // counter for binary array
    int i = 0;
    while (n > 0) {

        // storing remainder in binary array
        binaryNum[i] = n % 2;
        n = n / 2;
        i++;
    }

    // printing binary array in reverse order
    for (int j = i - 1; j >= 0; j--)
        cout << binaryNum[j];
}
int main(){
 #ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);
 freopen("output.txt", "w", stdout);
 #endif
ios_base::sync_with_stdio(false); cin.tie(0);
int t;
cin>>t;
while(t--){
	int n, m;
	cin>> n>> m;
	set<int> mS;

	FOR(i, 0, n, 1){
		string s;
		cin>> s;
		int number = stoi(s, 0, 2);
		/*cout<< number<< endl;*/
		mS.insert(number);
	}

	vector<int> fV;
	int lI = pow(2, m);
	FOR(i, 0, lI, 1){
		if(mS.find(i) == mS.end()){
			fV.PB(i);
		}
	}

	int mI = (fV.size() -1)/2;
	int ans = fV[mI];
	string aS = std::bitset<60>(ans).to_string();
	 cout<< aS.substr(60-m, m)<< endl;

}

}


#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define N 1e6
using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
#define  setp setprecision(10)
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef unsigned long long int  uint64;
set<ll> vis;
void moveleft(ll &median){
	median--;
	while(vis.find(median) != vis.end()){
		median--;
	}

}
void moveRight(ll &median){
	median++;
	while(vis.find(median) != vis.end()){
		median++;
	}

}

int main(){
 #ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);
 freopen("output.txt", "w", stdout);
 #endif
ios_base::sync_with_stdio(false); cin.tie(0);
int t;
cin>>t;
while(t--){
	vis.clear();
	int n, m;
	cin>>n>>m;
	vector<ll> tBR;
	FOR(i, 0, n, 1){
		string x;
		cin>>x;
		ll cI = stoi(x, 0, 2);

		tBR.PB(cI);

	}

	ll len = 1LL<<m;
	ll median = (1LL<<(m-1)) - 1;

	FOR(i, 0, n, 1){
		ll cV = tBR[i];

		if(cV == median){
			if(len%2 == 0){
				moveRight(median);
			}
			else{
				moveleft(median);
			}

		}
		else if(cV< median){
			if(len%2 == 0){
				moveRight(median);
			}

		}
		else{
			if(len%2 != 0){
				moveleft(median);
			}

		}

		vis.insert(cV);
		len--;
	}

	string res ="";

	while(median){
		res += median&1 ? "1" : "0";
		median >>= 1;
	}

	while(res.length()< m){
		res+= "0";
	}
	reverse(all(res));
	cout<< res<< endl;

	/*	string aS = std::bitset<60>(median).to_string();
	 cout<< aS.substr(60-m, m)<< endl;*/

}
}


#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define N 1e6
using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
const double pi=acos(-1.0);
#define  setp setprecision(10)
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef unsigned long long int  uint64;
set<ll> vis;
void moveleft(ll &median){
	median--;
	while(vis.find(median) != vis.end()){
		median--;
	}

}
void moveRight(ll &median){
	median++;
	while(vis.find(median) != vis.end()){
		median++;
	}

}

int main(){
 #ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);
 freopen("output.txt", "w", stdout);
 #endif
ios_base::sync_with_stdio(false); cin.tie(0);
int t;
cin>>t;
while(t--){
	vis.clear();
	int n, m;
	cin>>n>>m;
	vector<ll> tBR;
	FOR(i, 0, n, 1){
		string x;
		cin>>x;
		ll cI = stoi(x, 0, 2);

		tBR.PB(cI);

	}

	ll len = 1LL<<m;
	ll median = (1LL<<(m-1)) - 1;

	FOR(i, 0, n, 1){
		ll cV = tBR[i];

		if(cV == median){
			if(len%2 == 0){
				moveRight(median);
			}
			else{
				moveleft(median);
			}

		}
		else if(cV< median){
			if(len%2 == 0){
				moveRight(median);
			}

		}
		else{
			if(len%2 != 0){
				moveleft(median);
			}

		}

		vis.insert(cV);
		len--;
	}

		string aS = std::bitset<60>(median).to_string();
	 cout<< aS.substr(60-m, m)<< endl;

}
}


#include<bits/stdc++.h>
/*   -- AUTHOR --
  ---- cervotrex ----
*/
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define eb emplace_back
#define mk make_pair
#define all(arr) arr.begin(),arr.end()
#define mod 1000000007
const ll INF = 1LL << 60;
const int MAX_N = 1000005;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ook order_of_key
#define fbo find_by_order
// ordered_set <int> s  ;
// auto x=s.find_by_order(k);
// s.order_of_key(val);

ll to_int(string s){
  ll p=1, ans=0;
  ll n=s.length();
  for(int i=n-1;i>=0;i--){
    ans+=p*(s[i]-'0');
    p*=2;
  }
  return ans;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
    #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    cin>>t;
    while(t--){
      int n,m; cin>>n>>m;
      ll val = (1<<m);

      vector<string > s(n);
      for(int i=0;i<n;i++)
        cin>>s[i];

      vector<ll> a(n);
      for(int i=0;i<n;i++)
        a[i]=stoll(s[i],nullptr,2);

      sort(all(a));
      val=(val-n-1)/2;

      for(int i=0;i<n;i++)
        if(a[i]<=val)
          val++;

      // print(val, m);
      for(int i=m-1;i>=0;i--)
        cout<<(val>>i&1);
      cout<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
/*   -- AUTHOR --
  ---- cervotrex ----
*/
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define eb emplace_back
#define mk make_pair
#define all(arr) arr.begin(),arr.end()
#define mod 1000000007
const ll INF = 1LL << 60;
const int MAX_N = 1000005;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ook order_of_key
#define fbo find_by_order
// ordered_set <int> s  ;
// auto x=s.find_by_order(k);
// s.order_of_key(val);

ll to_int(string s){
  ll p=1, ans=0;
  int n=s.length();
  for(int i=n-1;i>=0;i--){
    ans+=p*(s[i]-'0');
    p*=2;
  }
  return ans;
}

void print(ll x, int m){
  // if(x==0){
  //   cout<<0;
  //   return ;
  // }
  vector<int> ans;
  while(x){
    ans.eb(x%2);
    x/=2;
  }
  while(ans.size()<m)
    ans.eb(0);
  reverse(all(ans));
  for(auto i:ans)
    cout<<i;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
    #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    cin>>t;
    while(t--){
      int n,m; cin>>n>>m;
      ll val = (1<<m); val--;

      vector<string > s(n);
      for(int i=0;i<n;i++)
        cin>>s[i];

      vector<ll> a(n);
      for(int i=0;i<n;i++){
        a[i]=to_int(s[i]);
      }

      sort(all(a));
      val=(val-n)/2;

      for(int i=0;i<n;i++)
        if(a[i]<=val)
          val++;

      print(val, m);
      cout<<"\n";
    }
    return 0;
}