#include<bits/stdc++.h>
using namespace std;
int n,a[200010],b[200010],cnt[200010],L,R,l,r;
inline int read()
{
	int x=0,w=0;char ch=0;
	while(!isdigit(ch)){w|=ch=='-';ch=getchar();}
	while(isdigit(ch)){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return w?-x:x;
}
int main()
{
	n=read();
	for(int i=1;i<=n;i++)cnt[a[i]=read()]++;
	for(int i=1;i<=n;i++)cnt[b[n-i+1]=read()]++;
	for(int i=1;i<=n;i++)
	if(cnt[i]>n){cout<<"No";return 0;}
	cout<<"Yes\n";
	L=n;R=1;l=1;r=n;
	for(int i=1;i<=n;i++)
	if(a[i]==b[i]){
		L=min(L,i);
		R=max(R,i);
	}
	for(int i=L;i<=R;i++){
		if(b[i]!=a[l]&&b[i]!=b[l]){
			swap(b[i],b[l]);
			l++;
		}else{
			swap(b[i],b[r]);
			r--;
		}
	}
	/*for(int i=L;i<=R;i++)
	if(l<L&&b[l]!=b[i])swap(b[i],b[l++]);
	else swap(b[i],b[r--]);*/
	for(int i=1;i<=n;i++)
		printf("%d ",b[i]);
}