考察位运算
#include<bits/stdc++.h>
using namespace std;
const int M=2e5+5;
typedef long long ll;
ll a[M];
ll huo[M];
ll ans[M];
void solve(){
int n; cin>>n;
memset(huo,0,sizeof(huo));
for(int i=1;i<=n;i++){
cin>>a[i];
huo[i]=huo[i-1]|a[i];
ans[i]=huo[i]^a[i];
}
for(int i=1;i<=n;i++){
cout<<ans[i]<<" ";
}
cout<<endl;
}
int main(){
int t; cin>>t;
while(t--){
solve();
}
return 0;
}