#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[i];

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
struct max_flow {
    struct edge { int to, cap, rev; };
    int V;
    vector<vector<edge>> G;
    vector<int> itr, level;

    max_flow(int V) : V(V) { G.assign(V,vector<edge>()); }

    void add_edge(int from, int to, int cap) {
        G[from].push_back((edge) {to, cap, (int) G[to].size()});
        G[to].push_back((edge) {from, 0, (int) G[from].size()-1});
    }

    void bfs(int s) {
        level.assign(V,-1);
        queue<int> q;
        level[s] = 0; q.push(s);
        while (!q.empty()) {
            int v = q.front(); q.pop();
            for(auto &e: G[v]){
                if (e.cap > 0 and level[e.to] < 0) {
                    level[e.to] = level[v] + 1;
                    q.push(e.to);
                }
            }
        }
    }

    int dfs(int v, int t, int f) {
        if (v == t) return f;
        for (int& i = itr[v]; i < (int) G[v].size(); ++i) {
            edge& e = G[v][i];
            if (e.cap > 0 and level[v] < level[e.to]) {
                int d = dfs(e.to, t, min(f, e.cap));
                if (d > 0) {
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }

    int run(int s, int t) {
        int ret = 0, f;
        while (bfs(s), level[t] >= 0) {
            itr.assign(V,0);
            while ((f = dfs(s, t, INF)) > 0) ret += f;
        }
        return ret;
    }
};
int main()
{
  ll N;
  cin >> N;
  VEC(ll,A,N);
  VEC(ll,B,N);
  reverse(ALL(B));
  int flag = 0;
  int cnt = 0;
  int now;
  int start;
  int end;
  REP(i,N){
    if(A[i]==B[i]){
      if(flag==0){
        start=i;
      }
      flag=1;
      cnt++;
      now=A[i];
      end=i;
    }
  }

  if(flag==0){
    cout << "Yes" << endl;
    REP(i,N){
      cout << B[i];
      if(i!=N-1){
        cout << " ";
      }
    }
    cout << endl;
  }else{
    int cnt2=0;
    REP(i,N){
      if(now!=A[i]&&now!=B[i]){
        cnt2++;
      }
    }
    if(cnt2>=cnt){
      cout << "Yes" << endl;
      REP(i,N){
        if(now!=A[i]&&now!=B[i]){
          swap(B[i],B[start]);
          start++;
          if(start>end) break;
        }
      }

      REP(i,N){
        cout << B[i];
        if(i!=N-1){
          cout << " ";
        }
      }
      cout << endl;
    }else{
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 6420