#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1000000007;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef pair<ll,Pll> PlP;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N), B(N), cnt(N+1);
    rep(i,N){
        cin >> A[i];
        cnt[A[i]]++;
    }
    rep(i,N){
        cin >> B[i];
        cnt[B[i]]++;
    }
    vector<set<ll>> q(N+1);
    REP(i,1,N+1){
        if(cnt[i] > N){
            cout << "No" << endl;
            return 0;
        }
        q[cnt[i]].insert(i);
    }
    cout << "Yes" << endl;
    auto make_cnt = [&](vector<ll>& a){
        map<ll,vector<ll>> cnt_;
        rep(i,N){
            cnt_[a[i]].push_back(i); 
        }
        return cnt_;
    };
    auto cnt_a = make_cnt(A);
    auto cnt_b = make_cnt(B);

    auto get_any = [&](map<ll,vector<ll>>& cnt_, ll x){
        for(auto& e:cnt_){
            if(e.fi != x){
                return e.fi;
            }
        }
    };
    vector<ll> ans(N,-1);
    for(ll i=N;i>0;i--){
        ll x=0, y=0;
        if(q[i].size() == 0){
            x = get_any(cnt_a, -1);
            y = get_any(cnt_b, x);
        }else if(q[i].size() == 1){
            x = *q[i].begin();
            if(!cnt_a.count(x)){
                y = x;
                x = get_any(cnt_a, y);
            }else{
                y = get_any(cnt_b, x);
            }
        }else{
            auto itr = q[i].begin();
            x = *itr;
            itr++;
            y = *itr;
            if(!cnt_a.count(x)){
                swap(x,y);
            }
        }
        ans[*cnt_a[x].rbegin()] = y;
    
        auto update_cnt = [&](map<ll,vector<ll>>& cnt_, ll x){
            cnt_[x].pop_back();
            if(cnt_[x].size() == 0){
                cnt_.erase(x);
            }
        };
        auto use = [&](ll x){
            q[cnt[x]].erase(x);
            cnt[x]--;
            q[cnt[x]].insert(x);
        };
        update_cnt(cnt_a, x);
        update_cnt(cnt_b, y);
        use(x);
        use(y);
    }
    PR(ans, N);
    /*
    vector<Pll> memoA(N+1), memoB(N+1);
    rep(i,N){
        cin >> A[i];
        memoA[A[i]].fi++;
        memoA[A[i]].se = A[i];
    }
    rep(i,N){
        cin >> B[i];
        memoB[B[i]].fi++;
        memoB[B[i]].se = B[i];
    }
    REP(i,1,N+1){
        if(N < memoA[i].fi + memoB[i].fi){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    multiset<Pll> AA,BB,CC;
    REP(i,1,N+1){
        AA.insert(memoA[i]);
        BB.insert(memoB[i]);
        CC.insert({memoA[i].fi + memoB[i].fi, i});        
    }
    vector<ll> ans(N);
    rep(i,N){
        auto itr = CC.rbegin();
        Pll p = *itr;
        itr++;
        Pll q;
        if(itr != CC.rend()){
            q = *itr;
        }else{
            cout << "aaa" << endl;
        }
        if(N-i < itr->fi){
            CC.erase(itr);
            p.fi--;
            CC.insert(p);
            if(memmoA[p.se]){
                memoA[p.se]--;
                memoB[q.se]--;

            }else{
                memoB[p.se]--;
                ans[i] = p.se;
            }
        }else{
            N--;
        }  
    }*/
}

Measured memory_bytes: 71788