#include<bits/stdc++.h>
using namespace std;
#define inf 1e18
#define endl '\n'
#define int long long
typedef long long ll;
typedef pair<int,int> pii;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const int maxn=2e5+9;
void solve(){
int n,x,y;
cin >> n >> x >> y;
if(n==1){
if(x==y){
cout << "YES" << endl;
cout << x << endl;
}else{
cout << "NO" << endl;
}
return;
}
if((x|y)!=x){
cout << "NO" << endl;
return;
}
int a1=x,a2=x^y;
cout << "YES" << endl;
if(n==2){
cout << a1 << " " << a2 << " ";
cout << endl;
return;
}
if(n==3){
cout << x-(x&-x) << " " << a2 << " " << (x&-x) << endl;
return;
}
cout << a1 << " " << a2 << " ";
if((n%2==0)){
for(int i=1;i<=n-2;i++) cout << x-(x&-x) << " ";
cout << endl;
return;
}else{
for(int i=1;i<=n-4;i++) cout << x-(x&-x) << " ";
cout << x << " " << (x&-x);
cout << endl;
return;
}
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int t=1;
cin >> t;
while(t--){
solve();
}
return 0;
}