#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mk make_pair
#define all(a) a.begin(), a.end()
#define len(a) (int)a.size()

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair <int, int> pii;

int main(){
	int n;
	cin >> n;
	vector <int> a(n), b(n);
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < n; i++)
		cin >> b[i];
		
	int j = 0, prev = -1;
	for(int i = 0; i < n; i++){
		if(a[i] != prev)
			j = 0;
		
		if(b[i] == a[i]){
			for(j; j < n; j++)
				if(b[j] != a[i] && a[i] != a[j]){
					swap(b[i], b[j]);
					break;
				}
			
			if(a[i] == b[i])
				return cout << "No" << endl, 0;
		}
		prev = a[i];
	}
	
	cout << "Yes" << endl;
	for(int i = 0; i < n; i++)
		cout << b[i] << ' ';
	cout << endl;
	
	return 0;
}
