#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
//#define DEBUG
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << '{';
    for(int i = 0; i < (int)v.size(); i++) {
        if(i) {
            os << ',';
        }
        os << v[i];
    }
    os << '}';
    return os;
}
void debugg() { cerr << endl; }
template <class T, class... Args>
void debugg(const T &x, const Args &... args) {
    cerr << " " << x;
    debugg(args...);
}
#define debug(...)                                                             \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debugg(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __Setup;

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < n; i++) {
        cin >> b[i];
    }
    // mp[num] := ai=biかつ、num=aiであるようなペアの数
    map<int, int> mp;
    for(int i = 0; i < n; i++) {
        if(a[i] == b[i]) {
            mp[a[i]]++;
        }
    }
    for(const auto &p : mp) {
        if(p.second > n / 2) {
            cout << "No" << endl;
            return 0;
        }
    }

    vector<pair<int, int>> v;
    {
        for(const auto &p : mp) {
            v.emplace_back(p.second, p.first);
        }
        sort(RALL(v));
    }
    // 予めペアにさせたい
    vector<pair<int, int>> pre;
    int now = 0;
    for(int i = 1; i < (int)v.size(); i++) {
        int mn = min(v[now].second, v[i].second);
        int mx = max(v[now].second, v[i].second);
        if(v[now].first >= v[i].first) {
            for(int j = 0; j < v[i].first; j++) {
                pre.emplace_back(mn, mx);
            }
            v[now].first -= v[i].first;
        } else {
            for(int j = 0; j < v[now].first; j++) {
                pre.emplace_back(mn, mx);
            }
            v[i].first -= v[now].first;
            now = i;
        }
    }
    multiset<int> B;
    for(int i = 0; i < n; i++) {
        B.insert(b[i]);
    }
    sort(ALL(pre));
    debug(pre);
    vector<int> ans(n, -1);
    {
        int id = 0;
        for(auto p : pre) {
            while(a[id] != p.first && id < n) {
                id++;
            }
            if(id == n) {
                break;
            }
            B.erase(B.find(p.second));
            debug(id, a[id], p.second);
            ans[id] = p.second;
            id++;
        }
    }
    for(int i = 0; i < n; i++) {
        if(ans[i] != -1) {
            continue;
        }
        auto it = B.upper_bound(a[i]);
        if(it != B.end()) {
            ans[i] = *it;
            B.erase(it);
            continue;
        }
        auto it2 = B.lower_bound(a[i]);
        if(it2 != B.begin()) {
            ans[i] = *prev(it2);
            B.erase(prev(it2));
        }
    }
    if(count(ALL(ans), -1) > 0) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    for(int i = 0; i < n; i++) {
        cout << ans[i] << " \n"[i == n - 1];
    }
}

Measured memory_bytes: 26708