unittest
{
//	assert( [ "6", "1 1 1 2 2 3", "1 1 1 2 2 3" ].solve == "Yes\n2 2 3 1 1 1" );
	assert( [ "6", "1 1 1 2 2 3", "1 1 1 2 2 3" ].solve == "Yes\n3 2 2 1 1 1" );
	assert( [ "3", "1 1 2", "1 1 3" ].solve == "No" );
	assert( [ "4", "1 1 2 3", "1 2 3 3" ].solve == "Yes\n3 3 1 2" );
}



import std.conv;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	input.popFront;
	auto bs = input.front.split.to!( long[] );
	
	auto acs = new long[ n + 1 ];
	foreach( a; as )
	{
		acs[ a ]++;
	}
	auto bcs = new long[ n + 1 ];
	long[ long ] bks;
	foreach( b; bs )
	{
		bcs[ b ]++;
		bks[ b ]++;
	}
	
	foreach( ac, bc; lockstep( acs, bcs ) )
	{
		if( n - ac < bc ) return "No";
	}
	
	auto anss = new long[ n ];
	foreach( ref ans, a; lockstep( anss, as ) )
	{
		foreach( b; bks.keys )
		{
			if( a != b )
			{
				ans = b;
				if( bks[ b ] == 1 ) bks.remove( b );
				else                bks[ b ]--;
				break;
			}
		}
	}
	return "Yes\n" ~ anss.to!( string[] ).join( " " );
}
