#include <bits/stdc++.h>
#ifdef local
#define debug(a...) qqbx(#a, a)
template <typename H, typename ...T> void qqbx(const char *s, const H &h, T&&...a) {
    for(; *s && *s != ','; ++s) if(*s != ' ') std::cerr<<*s;
    std::cerr<<" = "<<h<<(sizeof...(T) ? ", " : "\n");
    if constexpr(sizeof...(T)) qqbx(++s, a...);
}
#else
#define debug(...) ((void)0)
#endif // local
#define pb emplace_back
#define all(v) begin(v),end(v)

using namespace std;
const int MOD = 1000000007, N = 200025, inf = 2e9;
int a[N], b[N], ca[N], cb[N];
int A[N], B[N];
signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    for(int i = 0; i < n; i++) ++ca[a[i]];
    for(int i = 0; i < n; i++) ++cb[b[i]];
    for(int i = 1; i <= n; i++) if(ca[i] + cb[i] > n) return cout << "No\n", 0;
    for(int i = 1; i <= n; i++) ca[i] += ca[i-1];
    for(int i = 1; i <= n; i++) cb[i] += cb[i-1];
    int mx = 0;
    for(int i = 1; i <= n; i++) mx = max(mx, ca[i] - cb[i-1]);
    cout << "Yes\n";
    for(int i = 0; i < n; i++)
        cout << b[(i+n-mx)%n] << ' ';
    cout << '\n';
}

#include <iostream>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  unordered_map<int, int> Acnt;
  rep(i, N) {
    cin >> A[i];
    Acnt[A[i]]++;
  }
  vector<int> B(N);
  unordered_map<int, int> Bcnt;
  rep(i, N) {
    cin >> B[i];
    Bcnt[B[i]]++;
  }

  for (auto& a : Acnt) {
    if (Bcnt.count(a.first) && (N < a.second + Bcnt[a.first])) {
      cout << "No" << endl;
      return 0;
    }
  }

  int j = 0;
  int prev = -1;
  rep(i, N) {
    if (prev != A[i]) j = 0;
    if (A[i] == B[i]) {
      for (; j < N; ++j) {
        if (A[i] != A[j] && A[i] != B[j]) {
          swap(B[i], B[j]);
          break;
        }
      }
    }
    prev = A[i];
  }

  cout << "Yes" << endl;
  rep(i, N) {
    if (i != 0) cout << " ";
    cout << B[i];
  }
  cout << endl;
  return 0;
}
