#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; i < (i64)(n); ++i)
#define WHOLE(x) std::begin(x), std::end(x)
#define LEN(a) int((a).size())

template <class T>
bool chmax(T &a, T b) {
  if (a < b) return (a = move(b)), true;
  return false;
}
template <class T>
bool chmin(T &a, T b) {
  if (a > b) return (a = move(b)), true;
  return false;
}

template <typename T>
using V = std::vector<T>;
template <typename T>
vector<T> make_vec(size_t n, T a) {
  return vector<T>(n, a);
}
template <typename... Ts>
auto make_vec(size_t n, Ts... ts) {
  return vector<decltype(make_vec(ts...))>(n, make_vec(ts...));
}
template <typename T>
istream &operator>>(istream &is, vector<T> &a) {
  for (auto &x : a) is >> x;
  return is;
}
template <typename Container>
ostream &pprint(const Container &a, string_view sep = " ",
                string_view ends = "\n", ostream *os = nullptr) {
  if (os == nullptr) os = &cout;
  auto b = std::begin(a), e = std::end(a);
  for (auto it = std::begin(a); it != e; ++it) {
    if (it != b) *os << sep;
    *os << *it;
  }
  return *os << ends;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
  return pprint(a, ", ", "", &(os << "[")) << "]";
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &a) {
  return pprint(a, ", ", "", &(os << "{")) << "}";
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &a) {
  return pprint(a, ", ", "", &(os << "{")) << "}";
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &a) {
  return os << "(" << a.first << ", " << a.second << ")";
}

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int N;
  cin >> N;
  V<int> A(N), B(N);
  cin >> A >> B;

  V<tuple<int, bool, int>> combined;
  combined.reserve(2 * N);
  REP(i, N) { combined.emplace_back(A[i], false, i); }
  REP(i, N) { combined.emplace_back(B[i], true, i); }
  sort(WHOLE(combined));

  V<int> pa, pb;
  REP(i, N) {
    auto [numx, abx, ix] = combined[i];
    auto [numy, aby, iy] = combined[N + i];
    if (numx == numy) {
      cout << "No\n";
      exit(0);
    }
    if (abx != aby) continue;
    (abx ? pb : pa).push_back(i);
  }
  assert(LEN(pa) == LEN(pb));
  REP(i, LEN(pa)) {
    auto [numa1, _a1, ia1] = combined[pa[i]];
    auto [numa2, _a2, ia2] = combined[N + pa[i]];
    auto [numb1, _b1, ib1] = combined[pb[i]];
    auto [numb2, _b2, ib2] = combined[N + pb[i]];
    if (numa1 == numb1 or numa2 == numb2) {
      swap(combined[pa[i]], combined[pb[i]]);
    } else {
      int k1 = min(pa[i], pb[i]);
      int k2 = max(pa[i], pb[i]);
      swap(combined[k1], combined[N + k2]);
    }
  }

  V<int> ans(N, -1);
  REP(i, N) {
    auto [numx, abx, ix] = combined[i];
    auto [numy, aby, iy] = combined[N + i];
    assert(numx != numy);
    assert(abx != aby);
    if (abx) {
      // Ensure x=>a, y=>b
      swap(numx, numy);
      swap(abx, aby);
      swap(ix, iy);
    }
    ans[ix] = numy;
  }

  cout << "Yes\n";
  pprint(ans);
}


Measured memory_bytes: 11484