#include<bits/stdc++.h>
#define PI 3.141592653589793238462
using namespace std;
typedef long long ll;
typedef long double db;
ll a[200005],b[200005],p[200005];
int main(){
    ll n;cin>>n;
    for(ll i=1;i<=n;i++){
        cin>>a[i];p[a[i]]++;
    }
    for(ll i=1;i<=n;i++){
        cin>>b[i];p[b[i]]++;
    }
    for(int i=1;i<=n;i++){
        if(p[i]>n){cout<<"No"<<endl;return 0;}
    }
    cout<<"Yes"<<endl;
    reverse(b+1,b+1+n);
    for(int i=1;i<=n;i++){
        if(a[i]==b[i]){
            for(int j=1;j<=n;j++){
                if(b[j]!=a[i]&&b[i]!=a[j]){
                    swap(b[i],b[j]);break;
                }
            }
        }
    }
    for(int i=1;i<=n;i++){
        cout<<b[i]<<" ";
    }cout<<endl;
} 