#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
//const int MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const double pi = acos(-1.0);
const double EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

template<typename Monoid>
struct Segment_Tree{
    vector<Monoid> seg;
    const Monoid e;
    const int n;

    Monoid f(const Monoid &a, const Monoid &b) const {return max(a, b);}
    
    Segment_Tree(int N, const Monoid &e) : e(e), n(1<<(32-__builtin_clz(N-1))){
        seg.assign(2*n, e);
    }
    
    void change(int i, const Monoid &x){
        seg[i += n] = x;
        while(i > 0){
            i /= 2;
            seg[i] = f(seg[2*i], seg[2*i+1]);
        }
    }

    Monoid query(int a, int b, int i, int l, int r) const{
        if(a >= r || b <= l) return e;
        if(a <= l && r <= b) return seg[i];
        Monoid vl = query(a, b, 2*i, l, (l+r)/2);
        Monoid vr = query(a, b, 2*i+1, (l+r)/2, r);
        return f(vl, vr);
    }

    Monoid query(int a, int b) {return query(a, b, 1, 0, n);}

    bool check(const Monoid &a, const Monoid & b) const {return a <= b;}

    int find_first(int a, int b, const Monoid &x, int i, int l, int r) const{
        if(a >= b || a >= r || b <= l || !check(seg[i], x)) return -1;
        if(r-l == 1) return l;
        int m = (l+r)/2;
        if(b <= m) return find_first(a, b, x, 2*i, l, m);
        if(a >= m) return find_first(a, b, x, 2*i+1, m, r);
        int tmp = find_first(a, m, x, 2*i, l, m);
        return (tmp == -1? find_first(m, b, x, 2*i+1, m, r) : tmp);
    }

    int find_first(int a, int b, const Monoid &x) const {return find_first(a, b, x, 1, 0, n);}

    int find_last(int a, int b, const Monoid &x, int i, int l, int r) const{
        if(a >= b || a >= r || b <= l || !check(seg[i], x)) return -1;
        if(r-l == 1) return l;
        int m = (l+r)/2;
        if(b <= m) return find_last(a, b, x, 2*i, l, m);
        if(a >= m) return find_last(a, b, x, 2*i+1, m, r);
        int tmp = find_last(m, b, x, 2*i+1, m, r);
        return (tmp == -1? find_last(a, m, x, 2*i, l, m) : tmp);
    }

    int find_last(int a, int b, const Monoid &x) const {return find_last(a, b, x, 1, 0, n);}

    Monoid operator [] (int i) const {return seg[n+i];}
    
    void clear(){
        fill(all(seg), e);
    }
};

int main(){
    int N;
    cin >> N;
    int cnt1[N+1], cnt2[N+1];
    memset(cnt1, 0, sizeof cnt1), memset(cnt2, 0, sizeof cnt2);
    int A[N], B[N];
    rep(i, N){
        cin >> A[i];
        cnt1[A[i]]++;
    }
    rep(i, N){
        cin >> B[i];
        cnt2[B[i]]++;
    }
    int ans[N];
    fill(ans, ans+N, -1);
    int ptr[N+1];
    ptr[0] = 0;
    rep2(i, 0, N-1){
        ptr[i+1] = ptr[i]+cnt1[i];
    }
    int cnt[N+1];
    memset(cnt, 0, sizeof cnt);
    Segment_Tree<pii> seg(N+1, {-inf, 0});
    rep(i, N+1){
        seg.change(i, {cnt1[i]+cnt2[i], i});
    }
    int rem = N;
    
    while(true){
        pii p = seg.query(0, N+1);
        if(p.first == 0) break;
        if(p.first > rem) {cout << "No" << endl; return 0;}
        int i = p.second;
        seg.change(i, {0, i});
        if(cnt1[i] == 0 || cnt2[i] == 0) continue;
        while(cnt1[i] > 0){
            pii q = seg.query(0, N+1);
            if(q.first == 0) break;
            int j = q.second;
            if(cnt1[j] == 0 || cnt2[j] == 0) {seg.change(j, {0, j}); continue;}
            cnt1[i]--, cnt2[j]--, rem--;
            ans[ptr[i]+cnt[i]++] = j;
            seg.change(j, {cnt1[j]+cnt2[j], j});
        }
        while(cnt2[i] > 0){
            pii q = seg.query(0, N+1);
            if(q.first == 0) break;
            int j = q.second;
            if(cnt1[j] == 0 || cnt2[j] == 0) {seg.change(j, {0, j}); continue;}
            cnt1[j]--, cnt2[i]--, rem--;
            ans[ptr[j]+cnt[j]++] = i;
            seg.change(j, {cnt1[j]+cnt2[j], j});
        }
        if(cnt1[i] > 0 || cnt2[i] > 0){
            int now = 0;
            while(cnt2[i] > 0){
                while(ans[now] != -1 || A[now] == i) now++;
                ans[now++] = i, cnt2[i]--;
            }
            break;
        }
    }
    int now = 0;
    rep(i, N+1){
        while(cnt2[i]-- > 0){
            while(ans[now] != -1) now++;
            ans[now++] = i;
        }
    }
    cout << "Yes" << endl;
    rep(i, N) cout << ans[i] << ' ';
    cout << endl;
}

Measured memory_bytes: 12768