//#include "input.h"
//#include "output.h"
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")


#define NDEBUG
NDEBUG


#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>


using namespace std;

template<class T>
using vec = std::vector<T>;


#define FOR(i, n) for (int i = 0; i < (n); ++i)


#define all(c) c.begin(), c.end()


// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END


// Section with adoption of array and vector algorithms.


//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;


//bool __hack = std::ios::sync_with_stdio(false);
//auto __hack1 = cin.tie(nullptr);

struct Input {

    Input(istream &in) : in(&in) {}

    template<class T>
    T next() const {
        T x;
        *in >> x;
        return x;
    }

    int ni() const {
        return next<int>();
    }

    
    template<class T>
    vec<T> nVec(int n) const {
        vec<T> v(n);
        for (int i = 0; i < n; ++i) {
            v[i] = next<T>();
        }
        return v;
    }

    vec<int> nvi(int n) const {
        return nVec<int>(n);
    }

    
    istream *in;
};

Input in(cin);


class Output {

private:
ostream *out;

template<typename T>
void printSingle(const T &value) {
    *out << value;
}


template<typename T>
void printSingle(const vec<T> &v) {
    for (std::size_t i = 0; i < v.size(); ++i) {
        if (i == 0) {
            printSingle(v[i]);
//                *out << v[i];
        } else {
            *out << ' ';
            printSingle(v[i]);
//                *out << ' ' << v[i];
        }
    }
}

public:
Output(ostream &out) : out(&out) {}


inline void print() {}

template<typename T, typename...Ts>
inline void print(const T &f, const Ts&... args) {
    printSingle(f);
    if (sizeof...(args) != 0) {
        *out << ' ';
        print(args...);
    }
}

template<typename...Ts>
inline void println(const Ts&... args) {
    print(args...);
    *out << '\n';
}

template<typename...Ts>
inline void operator() (const Ts&... args) {
    println(args...);
}


};

Output out(cout);


namespace template_util {
    

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {
        
    };

    
    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}


#define dbg(...) ;


void solve(istream& inStream, ostream& outStream) {
    in = Input(inStream);
    out = Output(outStream);
    auto n = in.ni();
    auto a = in.nvi(n);
    auto b = in.nvi(n);
    auto b2 = b;
    reverse(all(b2));
    int n2 = n / 2;
    reverse(b2.begin(), b2.begin() + n2);
    reverse(b2.begin() + n2, b2.end());
    bool ok = true;
    FOR(i, n) {
        if (b2[i] == a[i]) {
            ok = false;
            break;
        }
    }
    if (ok) {
        out("Yes");
        out(b2);
        return;
    }

    map<int, int> cnta;
    for (auto i : a) {
        ++cnta[i];
    }
    map<int, int> cntb;
    for (auto i : b) {
        ++cntb[i];
    }
    vec<int> res(n);
    vec<int> freeAgents;

    auto get = [&] (int x) -> int {
        while (!cntb.empty() && cntb.begin()->first < x) {
            FOR(i, cntb.begin()->second) {
                freeAgents.push_back(cntb.begin()->first);
            }
            cntb.erase(cntb.begin());
        }
        while (true) {
            auto it = cntb.upper_bound(x);
            if (it == cntb.end()) {
                if (freeAgents.empty()) {
                    return -1;
                }
                int toReturn = freeAgents.back();
                freeAgents.pop_back();
                return toReturn;
            }
            int val = it->first;
            auto ita = cnta.find(val);
            if (ita == cnta.end()) {
                FOR(i, it->second) {
                    freeAgents.push_back(it->first);
                }
                cntb.erase(val);
                continue;
            } else {
                cntb[val]--;
                if (cntb[val] == 0) {
                    cntb.erase(val);
                }
                return val;
            }
        }


    };

    FOR(i, n) {
        auto bx = get(a[i]);
        dbg(i, bx);
        if (bx == -1) {
            out("No");
            return;
        }
        res[i] = bx;
    }
    out("Yes");
    out(res);
}

//#include <fstream>


int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
//    Input in(in);
//    Output out(out);
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}



Measured memory_bytes: 13640