#include<iostream>
#include<bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define deb(x)	cout << #x << " " << x << endl;

typedef long long int ll;

int main() {

	IOS

	int n;
	cin >> n;

	int a[n], b[n];

	for (int i = 0; i < n; i++)
		cin >> a[i];

	for (int i = n-1; i >= 0; i--)
		cin >> b[i];

	bool swapped = true;
	int prev = -1, j;

	for (int i = 0; i < n; i++) {
		if (a[i] == b[i]) {
			swapped = false;

			if (a[i] != prev)
				j = 0;

			for (; j < n; j++) {
				if (b[i] == b[j])
					continue;

				if (a[j] == b[i])
					continue;

				if (a[i] == b[j])
					continue;

				swap(b[i], b[j]);
				swapped = true;
				break;
			}

			if (!swapped)
				break;

			prev = a[i];
		}
	}

	if (swapped) {
		cout << "Yes" << endl;
		for (int i = 0; i < n; i++)
			cout << b[i] << " ";

	} else
		cout << "No";

	return 0;
}