using System;
using System.Linq;
using System.Collections.Generic;
class AC
{
    static void Main()
    {
        int N = Cin.Int();
        var A = Cin.ReadSplitInt();
        var B = Cin.ReadSplitInt();
        
        var cnt = new int[N];
        for(var i = 0; i < N; i++)
        {
            cnt[A[i] - 1]++; cnt[B[i] - 1]++;
        }
        for(var i = 0; i < N; i++)
        {
            if (cnt[i] > N)
            {
                Console.WriteLine("No");
                return;
            }
        }
        Console.WriteLine("Yes");
        var ok = true;
        for (var i = 0; i < N; i++) ok &= A[i] != B[i];
        if (ok) { Console.WriteLine(string.Join(" ", B)); return; }

        Array.Reverse(B);
        int cntL = 0, cntR = 0, val = -1;
        for(var i = 0; i < N; i++)
        {
            if (A[i] == B[i])
            {
                val = A[i];
            }
        }
        if (val == -1){ Console.WriteLine(string.Join(" ", B));return; }
        cntR = A.Count(x => x == val) + B.Count(x => x == val);
        var ans = new int[N];
        for(var i = 1; i < N; i++)
        {
            if (A[i - 1] == val) { cntL++;cntR--; }
            if (B[i - 1] == val) { cntL++;cntR--; }
            if (A[i - 1] == B[i - 1] || A[i] == B[i])
            {
                if (cntL <= i && cntR <= N - i)
                {
                    for (var j = 0; j < i; j++) ans[j] = B[i - 1 - j];
                    for (var j = 0; j < N - i; j++) ans[i + j] = B[N - 1 - j];
                    Console.WriteLine(string.Join(" ", ans));
                    return;
                }
            }
        }

    }
}
static class Cin
{
    public static string Str() => Console.ReadLine();
    public static int Int() => int.Parse(Cin.Str());
    public static long Long() => long.Parse(Cin.Str());
    public static double Double() => double.Parse(Cin.Str());

    private static T Conv<T>(string value) => (T)Convert.ChangeType(value, typeof(T));
    public static (T, U) ReadTuple<T, U>(string[] input) => (Conv<T>(input[0]), Conv<U>(input[1]));
    public static (T, U, V) ReadTuple<T, U, V>(string[] input) => (Conv<T>(input[0]), Conv<U>(input[1]), Conv<V>(input[2]));
    public static (T, U, V, W) ReadTuple<T, U, V, W>(string[] input) => (Conv<T>(input[0]), Conv<U>(input[1]), Conv<V>(input[2]), Conv<W>(input[3]));
    public static (T, U, V, W, X) ReadTuple<T, U, V, W, X>(string[] input) => (Conv<T>(input[0]), Conv<U>(input[1]), Conv<V>(input[2]), Conv<W>(input[3]), Conv<X>(input[4]));

    public static (T, U) Input<T, U>() => ReadTuple<T, U>(ReadSplit());
    public static (T, U, V) Input<T, U, V>() => ReadTuple<T, U, V>(ReadSplit());
    public static (T, U, V, W) Input<T, U, V, W>() => ReadTuple<T, U, V, W>(ReadSplit());
    public static (T, U, V, W, X) Input<T, U, V, W, X>() => ReadTuple<T, U, V, W, X>(ReadSplit());

    public static string[] ReadSplit() => Console.ReadLine().Split();
    public static string[] ReadSplit(char separator) => Console.ReadLine().Split(separator);
    public static int[] ReadSplitInt() => Array.ConvertAll(ReadSplit(), int.Parse);
    public static long[] ReadSplitLong() => Array.ConvertAll(ReadSplit(), long.Parse);
    public static double[] ReadSplit_Double() => Array.ConvertAll(ReadSplit(), double.Parse);
}


Measured memory_bytes: 74972