#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
  int N;
  cin>>N;
  int A[200000],B[200000];
  for(int i=0;i<N;i++) cin>>A[i];
  for(int i=0;i<N;i++) cin>>B[i];
  sort(B,B+N,greater<int>());
  vector<int> same;
  for(int i=0;i<N;i++){
    if(A[i]==B[i]) same.push_back(i);
  }
  int j=0;
  int judge=0;
  for(int i=0;i<same.size();i++){
    while(A[same[i]]==B[same[i]]){
      if(j==N){
        judge++; break;
      }
      if(A[j]!=B[same[i]]&&B[j]!=B[same[i]]) swap(B[same[i]],B[j]);
      j++;
    }
    if(judge==1) break;
  }
  if(judge==0){
    cout<<"Yes"<<endl;
    for(int i=0;i<N-1;i++) cout<<B[i]<<' ';
    cout<<B[N-1]<<endl;
  }
  else cout<<"No"<<endl;
  
  return 0;
}
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, A[200000], B[200000];
    cin >> N;
    map<int, int> mii;
    REP(i, N) {
        cin >> A[i];
        mii[A[i]]++;
    }
    REP(i, N) {
        cin >> B[i];
        mii[B[i]]++;
    }
    for (auto p : mii) {
        if (p.second > N) {
            cout << "No" << endl;
            return 0;
        }
    }

    int C[200001] = {}, D[200001] = {};
    REP(i, N) {
        C[A[i]]++;
        D[B[i]]++;
    }
    REP(i, N) {
        C[i + 1] += C[i];
        D[i + 1] += D[i];
    }

    int offset = 0;
    REP(i, N) {
        offset = max(D[i + 1] - C[i], offset);
    }
    cout << "Yes" << endl;
    REP(i, N) {
        cout << B[(i + offset) % N] << " ";
    }
    cout << endl;
}