#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Mod 1000000007
#define Max 1000001
#define vt vector<long long>
void func(){
ll n;
cin>>n;
ll a[n];
ll b[n];
unordered_map<ll, ll>ma, mb;
for(int i=0; i<n; i++){
cin>>a[i];
ma[a[i]]++;
}
for(int i=0; i<n; i++){
cin>>b[i];
mb[b[i]]++;
}
vector<ll>v;
ll i=0;
ll j=n-1;
while(true){
ll s=v.size();
if(s==n)
{
break;
}
if(a[i]!=b[j] && mb[b[j]]!=0){
v.push_back(b[j]);
mb[b[j]]--;
i++;
j--;
}
else if(a[i]==b[j]){
bool ok=false;
for(int k=0; k<n; k++){
if(a[i]!=b[k] && mb[b[k]]!=0){
v.push_back(b[k]);
mb[b[k]]--;
ok=true;
break;
}
}
if(!ok){
cout<<"No"<<endl;
return;
}
i++;
}
else if(a[i]!=b[j] && mb[b[j]]==0){
bool ok=false;
for(int k=0; k<n; k++){
if(a[i]!=b[k] && mb[b[k]]!=0){
v.push_back(b[k]);
mb[b[k]]--;
ok=true;
break;
}
}
if(!ok){
cout<<"No"<<endl;
return;
}
i++;
}
}
cout<<"Yes"<<endl;
for(auto i: v){
cout<<i<<" ";
}
cout<<endl;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//
// int t;
// cin >> t;
// for(ll i=1; i<=t; i++)
// {
func();
// cout<<endl;
//cout<<func()<<endl;
//if(func())
// cout<<"Yes"<< endl;
//else
// cout <<"No"<<endl;
//cout<<"Case"<<" "<<"#"<<i<<":"<<" "<<func()<<endl;
// }
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBNb2QgMTAwMDAwMDAwNwojZGVmaW5lIE1heCAxMDAwMDAxCiNkZWZpbmUgdnQgdmVjdG9yPGxvbmcgbG9uZz4KCnZvaWQgZnVuYygpewogICAgbGwgbjsKICAgIGNpbj4+bjsKICAgIGxsIGFbbl07CiAgICBsbCBiW25dOwogICAgdW5vcmRlcmVkX21hcDxsbCwgbGw+bWEsIG1iOwogICAgZm9yKGludCBpPTA7IGk8bjsgaSsrKXsKICAgICAgICAKICAgICAgICBjaW4+PmFbaV07CiAgICAgICAgbWFbYVtpXV0rKzsKICAgIH0KICAgIGZvcihpbnQgaT0wOyBpPG47IGkrKyl7CiAgICAgICAgY2luPj5iW2ldOwogICAgICAgIG1iW2JbaV1dKys7CiAgICB9CiAgICB2ZWN0b3I8bGw+djsKICAgIGxsIGk9MDsKICAgIGxsIGo9bi0xOwogICAgCiAgICB3aGlsZSh0cnVlKXsKICAgICAgICBsbCBzPXYuc2l6ZSgpOwogICAgICAgIGlmKHM9PW4pCiAgICAgICAgewogICAgICAgICAgICBicmVhazsKICAgICAgICB9CiAgICAgICAgaWYoYVtpXSE9YltqXSAmJiBtYltiW2pdXSE9MCl7CiAgICAgICAgICAgIHYucHVzaF9iYWNrKGJbal0pOwogICAgICAgICAgICBtYltiW2pdXS0tOwogICAgICAgICAgICBpKys7CiAgICAgICAgICAgIGotLTsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZihhW2ldPT1iW2pdKXsKICAgICAgICAgICAgYm9vbCBvaz1mYWxzZTsKICAgICAgICAgICAgZm9yKGludCBrPTA7IGs8bjsgaysrKXsKICAgICAgICAgICAgICAgIGlmKGFbaV0hPWJba10gJiYgbWJbYltrXV0hPTApewogICAgICAgICAgICAgICAgICAgIHYucHVzaF9iYWNrKGJba10pOwogICAgICAgICAgICAgICAgICAgIG1iW2Jba11dLS07CiAgICAgICAgICAgICAgICAgICAgb2s9dHJ1ZTsKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBpZighb2spewogICAgICAgICAgICAgICAgY291dDw8Ik5vIjw8ZW5kbDsKICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgfQogICAgICAgICAgICBpKys7CiAgICAgICAgfQogICAgICAgIGVsc2UgaWYoYVtpXSE9YltqXSAmJiBtYltiW2pdXT09MCl7CiAgICAgICAgICAgIGJvb2wgb2s9ZmFsc2U7CiAgICAgICAgICAgIGZvcihpbnQgaz0wOyBrPG47IGsrKyl7CiAgICAgICAgICAgICAgICBpZihhW2ldIT1iW2tdICYmIG1iW2Jba11dIT0wKXsKICAgICAgICAgICAgICAgICAgICB2LnB1c2hfYmFjayhiW2tdKTsKICAgICAgICAgICAgICAgICAgICBtYltiW2tdXS0tOwogICAgICAgICAgICAgICAgICAgIG9rPXRydWU7CiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYoIW9rKXsKICAgICAgICAgICAgICAgIGNvdXQ8PCJObyI8PGVuZGw7CiAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaSsrOwogICAgICAgIH0KICAgIH0KICAgIGNvdXQ8PCJZZXMiPDxlbmRsOwogICAgZm9yKGF1dG8gaTogdil7CiAgICAgICAgY291dDw8aTw8IiAiOwogICAgfQogICAgY291dDw8ZW5kbDsKfQoKaW50IG1haW4oKXsKIAppb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKY2luLnRpZShOVUxMKTsKY291dC50aWUoTlVMTCk7CiAKCi8vIAovLyBpbnQgdDsKLy8gY2luID4+IHQ7Ci8vIGZvcihsbCBpPTE7IGk8PXQ7IGkrKykKLy8gewogICAgZnVuYygpOwovLyAgICBjb3V0PDxlbmRsOwovL2NvdXQ8PGZ1bmMoKTw8ZW5kbDsKIAovL2lmKGZ1bmMoKSkKLy8gICAgY291dDw8IlllcyI8PCBlbmRsOwovL2Vsc2UKLy8gICAgY291dCA8PCJObyI8PGVuZGw7IAovL2NvdXQ8PCJDYXNlIjw8IiAiPDwiIyI8PGk8PCI6Ijw8IiAiPDxmdW5jKCk8PGVuZGw7Ci8vIH0KcmV0dXJuIDA7Cn0=