// #include <atcoder/all>
// using namespace atcoder;
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
using namespace std;
using ll = long long;
template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
/**
 * @brief 多次元 vector の作成
 * @author えびちゃん
 */
namespace detail {
    template<typename T, int N>
    auto make_vec(vector<int>& sizes, T const& x) {
        if constexpr (N == 1) {
            return vector(sizes[0], x);
        } else {
            int size = sizes[N-1];
            sizes.pop_back();
            return vector(size, make_vec<T, N-1>(sizes, x));
        }
    }
}
template<typename T, int N>
auto make_vec(int const(&sizes)[N], T const& x = T()) {
    vector<int> s(N);
    for (int i = 0; i < N; ++i) s[i] = sizes[N-i-1];
    return detail::make_vec<T, N>(s, x);
}
__attribute__((constructor))
void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    vector<int> cnt(n+1);
    map<int, int> cnta, cntb;
    rep(i, n) {
        cnt[a[i]]++;
        cnt[b[i]]++;
        cnta[a[i]]++;
        cntb[b[i]]++;
    }
    vector<set<int>> num(n+1);
    rep(i, n+1) {
        if (cnt[i] > 0) {
            if (cnt[i] > n) {
                cout << "No\n";
                return 0;
            }
            num[cnt[i]].insert(i);
        }
    }
    vector<pair<int, int>> ans;
    auto get_any = [](map<int, int>& cnt, int x) {
        for (auto p : cnt) {
            if (p.first != x) return p.first;
        }
        assert(false);
    };
    for (int i = n; i >= 1; --i) {
        int x = 0, y = 0;
        if (num[i].size() == 0) {
            x = cnta.begin()->first;
            y = get_any(cntb, x);
            int nx = cnta[x], ny = cntb[y];
            if (cntb.count(x)) nx += cntb[x];
            if (cnta.count(y)) ny += cnta[y];
            num[nx].erase(x);
            num[nx-1].insert(x);
            num[ny].erase(y);
            num[ny-1].insert(y);
        } else if (num[i].size() == 1) {
            x = *num[i].begin();
            num[i-1].insert(x);
            if (!cnta.count(x)) {
                y = x;
                x = get_any(cnta, y);
                int nx = cnta[x];
                if (cntb.count(x)) nx += cntb[x];
                num[nx].erase(x);
                num[nx-1].insert(x);
            } else {
                y = get_any(cntb, x);
                int ny = cntb[y];
                if (cnta.count(y)) ny += cnta[y];
                num[ny].erase(y);
                num[ny-1].insert(y);
            }
        } else {
            auto it = num[i].begin();
            x = *it;
            it++;
            y = *it;
            if (!cnta.count(x)) swap(x, y);
            num[i-1].insert(x);
            num[i-1].insert(y);
        }
        if (--cnta[x] == 0) cnta.erase(x);
        if (--cntb[y] == 0) cntb.erase(y);
        ans.emplace_back(x, y);
    }
    sort(ans.begin(), ans.end());
    cout << "Yes\n";
    rep(i, n) cout << ans[i].second << (i == n-1 ? '\n' : ' ');
}

Measured memory_bytes: 44940