#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000007
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n),b(n),asum(n+1,0),bsum(n+1,0);
  rep(i,n){
    cin >> a[i];
    asum[a[i]]++;
  }
  rep(i,n){
    cin >> b[i];
    bsum[b[i]]++;
  }
  rep(i,n+1){
    if(asum[i] + bsum[i] > n){
      cout << "No\n";
      return 0;
    }
  }
  rep(i,n){
    asum[i+1] += asum[i];
    bsum[i+1] += bsum[i];
  }
  int d = 0;
  rep(i,n+1){
    d = max(asum[i]-bsum[i-1],d);
  }
  cout << "Yes\n";
  rep(i,n){
    cout << b[(n+i-d)%n] << " ";
  }
  return 0;
}
#include <bits/stdc++.h>
#define maxn 200086

using namespace std;

int n;
int a[maxn], b[maxn];

int main(){
	scanf("%d", &n);
	for(int i = 1;i <= n;i++) scanf("%d", &a[i]);
	for(int i = 1;i <= n;i++) scanf("%d", &b[i]);
	reverse(b + 1, b + 1 + n);
	int l = n, r = 1;
	for(int i = 1;i <= n;i++){
		if(a[i] == b[i]) l = min(l, i), r = max(r, i);
	}
	for(int i = 1;i <= n && l <= r;i++){
		if(a[i] != a[l] && b[i] != a[l]) swap(b[i], b[l++]);
	}
	if(l <= r) return printf("No"), 0;
	puts("Yes");
	for(int i = 1;i <= n;i++) printf("%d ", b[i]);
}