#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<ll,ll> pint;
 
int a[100001],b[100001],c[100001];
int main(){
    int n;
    cin>>n;
    rep(i,n) cin>>a[i];
    int cur=-1;
    rep(i,n){
        cin>>b[i];
        ++c[b[i]];
        if(c[b[i]]>=2) cur=1;
    }
    if(cur==-1){
        cout<<"Yes"<<endl;
        return 0;
    }
    int num;
    rep(i,n){
        if(c[a[i]]==0){
            num=i;
        }
    }
    cout<<"No"<<endl;
    rep(i,n) cout<<a[i]<<(i==n-1?"":" ");
    cout<<endl;
    rep(i,n){
        if(num!=i)cout<<a[i]<<(i==n-1?"":" ");
        else cout<<a[(i+1)%n]<<(i==n-1?"":" ");
    }
    cout<<endl;
    return 0;
}
