#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;

const lld N = 200043;
const lld MOD = 1000000007;

lld add(lld x, lld y)
{
    x =((x%MOD)+(y%MOD))%MOD;
    while(x >= MOD) x -= MOD;
    while(x < 0) x += MOD;
    return x;
}

lld mul(lld x, lld y)
{
    return ((x%MOD)*(y%MOD))% MOD;
}

lld binpow(lld x, lld y)
{
    lld z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}

lld inv(lld x)
{
    return binpow(x, MOD - 2);
}

lld divide(lld x, lld y)
{
    return mul(x, inv(y));
}

// Combinations

/*
lld fact[N];

void precalc()
{
    fact[0] = 1;
    for(lld i = 1; i < N; i++)
        fact[i] = mul(fact[i - 1], i);
}

lld C(lld n, lld k)
{
    return divide(fact[n], mul(fact[k], fact[n - k]));
}
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t,i,j;
    //cin>>t;
    t=1;
    while(t--)
    {
        lld n;
        cin>>n;
        lld ar[n];
        vector<lld>br(n);
        lld er[n];
        lld cr[n+1]={0};
        lld dr[n+1]={0};
        for(i=0;i<n;i++)
            cin>>ar[i],cr[ar[i]]++;
        for(i=0;i<n;i++)
            cin>>br[i],dr[br[i]]++,er[i]=br[i];
        for(i=1;i<=n;i++)
        {
            if(cr[i]+dr[i]>n)
            {
                cout<<"No"<<endl;
                return 0;
            }
        }
        lld ptr=1;
        for(i=0;i<n;i++)
            if(ar[i]==er[n-1-i])
            ptr=0;
        if(ptr)
        {   cout<<"Yes"<<endl;
            for(i=0;i<n;i++)
                cout<<er[n-1-i]<<" ";
            cout<<endl;
            return 0;
        }
        set<lld>s;
        vector<lld>v;
        vector<lld>v2;
        for(i=0;i<n;i++)
        {
            if(ar[i]==br[i])
            {
                s.insert(i);
                v.push_back(br[i]);
            }
            else
                v2.push_back(br[i]);
        }
        sort(v.rbegin(),v.rend());
        lld ans[n]={0};
        j=0;
        for(i=0;i<n;i++)
        {
            if(s.find(i)==s.end())
                ans[i]=br[i];
            else
            {
                ans[i]=v[j];
                j++;
            }
        }
        lld ctr=1;
        for(i=0;i<n;i++)
        {
            if(ar[i]==ans[i])
            {
                ctr=0;
            }
        }
        if(ctr)
        {
        cout<<"Yes"<<endl;
        for(i=0;i<n;i++)
            cout<<ans[i]<<" ";
        cout<<endl;
        return 0;
        }
            j=n-1;
            for(i=0;i<n;i++)
            {
                if(ar[i]==er[i])
                    swap(er[i],er[j]),j--;
            }
            lld gtr=1;
            for(i=0;i<n;i++)
            if(ar[i]==er[i])
            gtr=0;
            if(gtr)
            {
            cout<<"Yes"<<endl;
            for(i=0;i<n;i++)
                cout<<er[i]<<" ";
            cout<<endl;
            return 0;
            }
        lld ftr[n]={0};
        set<lld>se;
        for(i=1;i<=n;i++)
            if(dr[i]>0)
            se.insert(i);
        for(i=0;i<n;i++)
        {
            j=ar[i]+1;
            auto it=se.lower_bound(j);
            if(it==se.end())
            continue;
            ftr[i]=*it;
            dr[*it]--;
            if(dr[*it]==0)
               se.erase(*it);
        }
        vector<lld>bgr;
        for(i=0;i<n;i++)
        {
            for(j=0;j<dr[i];j++)
                bgr.push_back(i);
        }
        sort(bgr.rbegin(),bgr.rend());
        j=0;
        for(i=0;i<n;i++)
            if(ftr[i]==0)
            ftr[i]=bgr[j],j++;
        lld str=1;
        for(i=0;i<n;i++)
            if(ftr[i]==ar[i])
            str=0;
        if(str)
        {
        cout<<"Yes"<<endl;
        for(i=0;i<n;i++)
            cout<<ftr[i]<<" ";
        cout<<endl;
        return 0;
        }
         cout<<"Yes"<<endl;
         for(i=n/2;i<n;i++)
            cout<<br[i]<<" ";
         for(i=0;i<n/2;i++)
            cout<<br[i]<<" ";
         cout<<endl;
         return 0;
        lld seed=-1;
        while(true)
        {  seed++;
            shuffle(br.begin(),br.end(), default_random_engine(seed));
            str=1;
        for(i=0;i<n;i++)
            if(ftr[i]==ar[i])
            str=0;
        if(str)
        {
        cout<<"Yes"<<endl;
        for(i=0;i<n;i++)
            cout<<ftr[i]<<" ";
        cout<<endl;
        return 0;
        }
        }

    }
}





Measured memory_bytes: 26556