#include <bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define MAXN 200005
#define REP(temp, init_val, end_val) for (int temp = init_val; temp <= end_val; ++temp)
#define REPR(temp, init_val, end_val) for (int temp = init_val; temp >= end_val; --temp)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> intpair;
int read(){
    int f = 1, x = 0;
    char c = getchar();
    while (c < '0' || c > '9'){if(c == '-') f = -f; c = getchar();}
    while (c >= '0' && c <= '9')x = x * 10 + c - '0', c = getchar();
    return f * x; 
}
inline int lowbit(int x){
    return x & (-x);
}
inline int modadd(int x, int y){
    return (x + y >= MOD ? x + y - MOD: x + y);
}
inline int sgn(int x){
    return (x < 0 ? -1: (x > 0 ? 1: 0));
}
template<typename T>
T gcd(T a, T b){
    return (!b) ? a: gcd(b, a % b);
}
int poww(int a, int b){
    int res = 1;
    while (b > 0){
        if (b & 1) res = 1ll * res * a % MOD;
        a = 1ll * a * a % MOD, b >>= 1;
    }
    return res;
}
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
const int ddx[] = {-1, -1, -1, 0, 0, 1, 1, 1}, ddy[] = {-1, 0, 1, -1, 1, -1, 0, 1};

/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/

int n, a[200005], b[200005];
vector<int> G[200005];
int cnta[200005] = {0}, cntb[200005] = {0};
int ans[200005] = {0};
pair<int, int> p[200005];
set<pair<int, int> > st;
std::mt19937 gen;
void init(){
    n = read();
    REP(i, 1, n) a[i] = read(), ++cnta[a[i]], G[a[i]].push_back(i);
    REP(i, 1, n) b[i] = read(), ++cntb[b[i]];
}
void solve(){
    int tot = 0;
    REP(i, 1, n){
        if (cnta[i] + cntb[i] > 0) 
            p[++tot] = make_pair(cnta[i] + cntb[i], i), 
            st.insert(p[tot]);
    }
    sort(p + 1, p + tot + 1);
    if (p[tot].first > n) {
        printf("No\n");
        return ;
    }
    printf("Yes\n");
    int cur = tot;
    REPR(i, tot, 1){
        int h = p[i].second;
        if (!cntb[h]) continue;
        
        bool flag = false;
        if (st.count(p[i])) flag = true, st.erase(p[i]);
        while (cntb[h]--){
            for (; ; ){
                if (st.empty()){
                    // only left for itself
                    int t = G[h].back();
                    G[h].pop_back();
                    ans[t] = h;
                    break;
                }
                auto pp = *st.rbegin();
                if (!cnta[pp.second]) {
                    st.erase(pp);
                    continue;
                }
                --cnta[pp.second];
                int t = G[pp.second].back();
                G[pp.second].pop_back();
                ans[t] = h;
                break;
            }
        }
        if (flag) st.insert(p[i]);
    }

    // randomly change
    REP(i, 1, n){
        if (a[i] == ans[i]){
            for (; ; ){
                int t = gen() % n + 1;
                if (ans[i] != a[t] && ans[t] != a[i]){
                    swap(ans[t], ans[i]);
                    break;
                }
            }
        }
    }
    REP(i, 1, n) printf("%d%c", ans[i], (i == n ? '\n': ' '));
}
int main(){
    int T = 1;
    while (T--){
        init();
        solve();
    }
    return 0;
}

Measured memory_bytes: 29408