#include <bits/stdc++.h>
using namespace std;
int res = 0 ;
void check(string per[4],int tmp[3][2]){
int cnt[3][2] ;
for(int i=0;i<3;i++){
for(int j=0;j<2;j++){
cnt[i][j] = tmp[i][j] ;
}
}
int ans = 0 ;
for(int i=0;i<4;i++){
int nax = min(cnt[0][per[i][0]-'0'],cnt[1][per[i][1]-'0']);
nax = min(nax,cnt[2][per[i][2]-'0']);
cnt[0][per[i][0]-'0']-=nax;
cnt[1][per[i][1]-'0']-=nax;
cnt[2][per[i][2]-'0']-=nax;
ans+=nax;
}
res = max(res,ans);
}
int main(){
int t ;
cin >> t ;
while(t--){
res = 0 ;
string per[] = {"111","100","010","001"} ;
sort(per,per+4);
int cnt[3][2] ;
for(int i=0;i<3;i++){
for(int j=0;j<2;j++){
cnt[i][j] = 0 ;
}
}
for(int i=0;i<3;i++){
string s ;
cin >> s ;
for(int j=0;j<s.size();j++){
cnt[i][s[j]-'0']++;
}
}
do{
check(per,cnt);
}while(next_permutation(per,per+4));
string ones(res,'1');
string zeros(10-res,'0');
cout << ones + zeros << endl;
}
return 0 ;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCByZXMgPSAwIDsKdm9pZCBjaGVjayhzdHJpbmcgcGVyWzRdLGludCB0bXBbM11bMl0pewogICAgaW50IGNudFszXVsyXSA7CiAgICBmb3IoaW50IGk9MDtpPDM7aSsrKXsKICAgICAgICBmb3IoaW50IGo9MDtqPDI7aisrKXsKICAgICAgICAgICAgY250W2ldW2pdID0gdG1wW2ldW2pdIDsKICAgICAgICB9CiAgICB9CiAgICBpbnQgYW5zID0gMCA7CiAgICBmb3IoaW50IGk9MDtpPDQ7aSsrKXsKICAgICAgICBpbnQgbmF4ID0gbWluKGNudFswXVtwZXJbaV1bMF0tJzAnXSxjbnRbMV1bcGVyW2ldWzFdLScwJ10pOwogICAgICAgIG5heCA9IG1pbihuYXgsY250WzJdW3BlcltpXVsyXS0nMCddKTsKICAgICAgICBjbnRbMF1bcGVyW2ldWzBdLScwJ10tPW5heDsKICAgICAgICBjbnRbMV1bcGVyW2ldWzFdLScwJ10tPW5heDsKICAgICAgICBjbnRbMl1bcGVyW2ldWzJdLScwJ10tPW5heDsKICAgICAgICBhbnMrPW5heDsKICAgIH0KICAgIHJlcyA9IG1heChyZXMsYW5zKTsKfQppbnQgbWFpbigpewogICAgaW50IHQgOwogICAgY2luID4+IHQgOwogICAgd2hpbGUodC0tKXsKICAgICAgICByZXMgPSAwIDsKICAgICAgICBzdHJpbmcgcGVyW10gPSB7IjExMSIsIjEwMCIsIjAxMCIsIjAwMSJ9IDsKICAgICAgICBzb3J0KHBlcixwZXIrNCk7CiAgICAgICAgaW50IGNudFszXVsyXSA7CiAgICAgICAgZm9yKGludCBpPTA7aTwzO2krKyl7CiAgICAgICAgICAgIGZvcihpbnQgaj0wO2o8MjtqKyspewogICAgICAgICAgICAgICAgY250W2ldW2pdID0gMCA7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZm9yKGludCBpPTA7aTwzO2krKyl7CiAgICAgICAgICAgIHN0cmluZyBzIDsKICAgICAgICAgICAgY2luID4+IHMgOwogICAgICAgICAgICBmb3IoaW50IGo9MDtqPHMuc2l6ZSgpO2orKyl7CiAgICAgICAgICAgICAgICBjbnRbaV1bc1tqXS0nMCddKys7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZG97CiAgICAgICAgICAgIGNoZWNrKHBlcixjbnQpOwogICAgICAgIH13aGlsZShuZXh0X3Blcm11dGF0aW9uKHBlcixwZXIrNCkpOwogICAgICAgIHN0cmluZyBvbmVzKHJlcywnMScpOwogICAgICAgIHN0cmluZyB6ZXJvcygxMC1yZXMsJzAnKTsKICAgICAgICBjb3V0IDw8IG9uZXMgKyB6ZXJvcyA8PCBlbmRsOwogICAgfQogICAgcmV0dXJuIDAgOwp9Cg==