using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
using System.Threading;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var a=sc.Ia;
		var b=sc.Ia;
		var aq=new Queue<int>[n+1];
		var bq=new Queue<int>[n+1];
		for(int i = 1;i<=n;i++) {
			aq[i]=new Queue<int>();
			bq[i]=new Queue<int>();
		}
		for(int i = 0;i<n;i++) {
			aq[a[i]].Enqueue(i);
			bq[b[i]].Enqueue(i);
		}
		St st=new St(n+1,true,true,0);
		for(int i = 1;i<=n;i++) {
			if(aq[i].Count+bq[i].Count==0){continue;}
			if(aq[i].Count+bq[i].Count>n){
				Console.WriteLine("No");
				return;
			}
			st.Ud(i,aq[i].Count+bq[i].Count);
		}
		var ans=new int[n];
		for(int i = 0,al=1,ar=n,bl=1,br=n;i<n;i++) {
			var e=st.Get(1,n);
			st.Ud(e.n,-1);
			if(aq[e.n].Count>0){
				while(bq[bl].Count==0){bl++;}
				while(bq[br].Count==0){br--;}
				if(bl!=e.n){
					bq[bl].Dequeue();
					ans[aq[e.n].Dequeue()]=bl;
					st.Ud(bl,-1);
				}
				else{
					bq[br].Dequeue();
					ans[aq[e.n].Dequeue()]=br;
					st.Ud(br,-1);
				}
			}
			else{
				while(aq[al].Count==0){al++;}
				while(aq[ar].Count==0){ar--;}
				bq[e.n].Dequeue();
				if(al!=e.n){
					ans[aq[al].Dequeue()]=e.n;
					st.Ud(al,-1);
				}
				else{
					ans[aq[ar].Dequeue()]=e.n;
					st.Ud(ar,-1);
				}
			}
		}
		Console.WriteLine("Yes");
		Console.WriteLine(string.Join(" ",ans));
	}
}
public class St{
	public class Dt{
		public int n;
		public long d;
		public Dt(long d,int n){this.d=d;this.n=n;}
		public override string ToString()=>"n:"+n.ToString()+" d:"+d.ToString();
	}
	private Dt[] dat;
	private int n,cnt;
	private bool ku;
	private Dt du;
	private Func<Dt,Dt,Dt> compare;
	public St(int n,bool mm,bool ku,long df){
		this.n=n;
		this.ku=ku;
		if(mm){du=new Dt(long.MinValue,-1);compare=CoMax;}
		else{du=new Dt(long.MaxValue,-1);compare=CoMin;}
		cnt=n<<1;
		dat=new Dt[cnt];
		for(int i = cnt-1;i>=cnt-n;i--) {dat[i]=new Dt(df,n-cnt+i);}
		for(int i = cnt-n-1;i>0;i--) {dat[i]=dat[i<<1];}
	}
	private Dt CoMax(Dt x,Dt y){return x.d>y.d?x:y;}
	private Dt CoMin(Dt x,Dt y){return x.d<y.d?x:y;}
	public void Ud(int q,long b){
		q+=n;
		if(ku){dat[q].d+=b;}
		else{dat[q].d=b;}
		while(q>1){dat[q>>=1]=compare(dat[q<<1],dat[(q<<1)+1]);}
	}
	public Dt Get(int l,int r){
		Dt x=du;
		l+=n;r+=n;
		while(l<=r){
			if((l&1)==1){x=compare(x,dat[l++]);}
			if((r&1)==0){x=compare(x,dat[r--]);}
			l>>=1;r>>=1;
		}
		return x;
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 101692