#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

struct SegmentTree{
    const int INF = 1e9;
    int n, width;
    VI dat;

    void init(int x){
        n = x;
        width = 1;
        while (width < n) width *= 2;
        dat.resize(2*width-1);
        REP(i,2*width-1) dat[i] = INF;
    }

    void update(int i, int x){
        i += width - 1;
        dat[i] = x;
        while (i > 0){
            i = (i - 1) / 2;
            dat[i] = min(dat[i*2+1], dat[i*2+2]);
        }
    }

    int query(int a, int b, int k, int l, int r){
        if (r <= a || b <= l) return INF;
        if (a <= l && r <= b) return dat[k];
        int vl = query(a, b, k*2+1, l, (l+r)/2);
        int vr = query(a, b, k*2+2, (l+r)/2, r);
        return min(vl, vr);
    }

    // [l, r)
    int query(int l, int r){
        return query(l, r, 0, 0, width);
    }
};

int main(void){
    int n;
    cin >> n;
    VI a(n), b(n), cnta(n), cntb(n);
    REP(i,n){
        a[i] = in() - 1;
        cnta[a[i]]++;
    }
    REP(i,n){
        b[i] = in() - 1;
        cntb[b[i]]++;
    }
    VI sum(n);
    REP(i,n){
        sum[i] = cnta[i] + cntb[i];
        if (sum[i] > n){
            cout << "No" << endl;
            return 0;
        }
    }
    map<int, int> mp;
    REP(i,n) mp[b[i]]++;
    SegmentTree seg;
    seg.init(n);
    REP(i,n) seg.update(i, -sum[i]);
    VI ans(n, -1);
    REP(i,n){
        int ma = -seg.query(0, n);
        if (ma == n - i){
            // cout << "here" << i << endl;
            int x = -1;
            REP(j,n) if (cnta[j] + cntb[j] == n - i) x = j;
            FOR(j,i,n-1) if (a[j] != x) ans[j] = x;
            cntb[x] = 0;
            int y = 0;
            // REP(j,n) cout << ans[j] << " ";
            // cout << endl;
            FOR(j,i,n-1){
                while (cntb[y] == 0) y++;
                if (ans[j] == -1){
                    ans[j] = y;
                    cntb[y]--;
                }
            }
            break;
        }
        auto itr = mp.begin();
        while (itr->first == a[i]) itr++;
        int x = itr->first;
        ans[i] = x;
        mp[x]--;
        cntb[x]--;
        if (mp[x] == 0) mp.erase(x);
        seg.update(x, seg.query(x, x + 1) + 1);
        seg.update(a[i], seg.query(a[i], a[i] + 1) + 1);
    }
    cout << "Yes" << endl;
    REP(i,n){
        printf("%d ", ans[i] + 1);
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 19336