#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=1e6+7; #define int long long int a[107]; int n,m; int check(int x) { int ret=x; for (int i=1; i<=n; i++) if (a[i]<=x) ret--; ret++; return ret>=((1ll<<m)-n-1)/2+1; } signed main() { int t; cin>>t; while (t--) { cin>>n>>m; for (int i=1; i<=n; i++) { string s; cin>>s; int now=0; for (char c:s) now=now*2+(c-'0'); a[i]=now; } int l=0,r=(1ll<<m); while(l<r) { int mid=(l+r)>>1; if (check(mid)) r=mid; else l=mid+1; } vector<int> v; for (int i=0; i<m; i++) v.push_back(r&1),r>>=1; reverse(v.begin(),v.end()); for (int i:v) cout<<i; cout<<endl; } }