#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = (ll)a;i < (ll)b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = (ll)b-1LL;i >= (ll)a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;
typedef pair<pll,ll> plll;

pll operator+(pll a,pll b){
  return pll(a.first+b.first,a.second+b.second);
}
pll operator-(pll a,pll b){
  return pll(a.first-b.first,a.second-b.second);
}
pll operator*(ll a,pll b){
  return pll(b.first*a,b.second*a);
}
const ll INF=(1LL<<60);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  a=abs(a);
  b=abs(b);
  if(a==0)return b;
  if(b==0)return a;
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}

const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::vector<long long> A, std::vector<long long> B){
  auto cmpplll = [](plll xx,plll yy){
    auto x=xx.first,y=yy.first;
    ll X=x.first+x.second,Y=y.first+y.second;
    if(y==pll(0,0))Y=-3;
    else if(y.first==0)Y=-1;
    else if(y.second==0)Y=-2;
    if(x==pll(0,0))X=-3;
    else if(x.first==0)X=-1;
    else if(x.second==0)X=-2;

    return X==Y?xx.second<yy.second:X<Y;
  };
  vector<ll> cntA(N),cntB(N);
  REP(N){
    cntA[A[i]]++;
    cntB[B[i]]++;
  }
  REP(N){
    if(cntA[i]+cntB[i]>N){
      cout<<NO<<endl;
      return;
    }
  }
  priority_queue<plll,vector<plll>,decltype(cmpplll)> q(cmpplll);
  REP(N){
    if(cntA[i]||cntB[i]){
      q.push(plll(pll(cntA[i],cntB[i]),i));
    }
  }
  vector<pll> ans;
  while(!q.empty()){
    auto [cur,curx]=q.top();q.pop();
    dump(cur);dump(curx);
    if(cur.first==0||cur.second==0){
      q.push(plll(cur,curx));
      break;
    }
    while(cur.first>0){
      auto [next,nextx]=q.top();q.pop();
      dump(next);dump(nextx);
      next.second-=1;
      cur.first-=1;
      ans.push_back(pll(curx,nextx));
      if(next!=pll(0,0)){
        q.push(plll(next,nextx));
      }
    }
    if(cur!=pll(0,0)){
      q.push(plll(cur,curx));
    }
  }
  if(!q.empty()){
    vector<plll> fnotnull,snotnull;
    while(!q.empty()&&q.top().first.first==0){
      snotnull.push_back(q.top());
      q.pop();
    }
    while(!q.empty()){
      fnotnull.push_back(q.top());
      q.pop();
    }
    dump(fnotnull);
    dump(snotnull);
    while(!fnotnull.empty()&&!snotnull.empty()){
      auto [f,fx]=fnotnull.back();fnotnull.pop_back();
      auto [s,sx]=snotnull.back();snotnull.pop_back();
      dump(f);dump(fx);
      dump(s);dump(sx);
      ll tmp=min(f.first,s.second);
      f.first-=tmp;
      s.second-=tmp;
      REP(tmp)ans.push_back(pll(fx,sx));
      if(f.first)fnotnull.push_back(plll(f,fx));
      else snotnull.push_back(plll(s,sx));
    }
  }
  sort(ans.begin(),ans.end());
  cout<<YES<<endl;
  REP(ans.size()){
    cout<<1+ans[i].second<<" ";
  }
  cout<<endl;
}

int main(){
  cout<<setprecision(1000);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
        --A[i];
    }
    std::vector<long long> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&B[i]);
        --B[i];
    }
    solve(N, std::move(A), std::move(B));
    return 0;
}


Measured memory_bytes: 27656