#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
int len(int x){
int ans=0;
while(x){
x>>=1;
++ans;
}
return ans;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int T;
cin>>T;
for(int _=0;_<T;++_){
int a,b,c;
cin>>a>>b>>c;
vector<int>ans;
if(c==0){
while(b){
b>>=1;
ans.push_back(2);
}
if(a){
ans.push_back(4);
ans.push_back(3);
while(a){
a>>=1;
ans.push_back(2);
}
}
}else if(a==0&&b==0){
goto no;
}else{
if(len(b)<len(c)){
if(len(a)>=len(c)){
b^=a;
ans.push_back(4);
}else{
if(len(b)<len(a)){
b^=a;
ans.push_back(4);
}
int pa=1<<(len(b)-1),pc=1<<(len(c)-1);
while(pa!=pc){
if((!(a&pa))!=(!(c&pc))){
a^=b;
ans.push_back(3);
}
a<<=1;
ans.push_back(1);
pc>>=1;
}
}
}
int p=1<<(len(b)-1);
while(b){
if((a&p)!=(c&p)){
a^=b;
ans.push_back(3);
}
b>>=1;
ans.push_back(2);
p>>=1;
}
ans.push_back(4);
}
cout<<ans.size()<<endl;
for(int i=0;i<ans.size();++i){
if(i)cout<<' ';
cout<<ans[i];
}
cout<<endl;
continue;
no:
cout<<"-1\n";
}
return 0;
}