#include<bits/stdc++.h>

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

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

typedef long long ll;
typedef pair<int,int> ii;

vector<int> ansB;
bool bf(int n,vector<int> A,vector<int> B) {
  do {
    bool ok = true;
    rep(i,n) {
      if( A[i] == B[i] ) {
	ok = false;
	break;
      }
    }
    if( ok ) {
      ansB = B;
      return true;
    }
  } while( next_permutation(ALL(B)) );
  return false;
}

bool myans = false;

void solver6(int n,vector<int> A,vector<int> B) {
  sort(ALL(B));
  reverse(ALL(B));
  int cur0 = 0;
  int curn = n-1;
  rep(i,n) {
    if( A[i] == B[i] ) {
      if( A[i] != B[cur0] && A[cur0] != B[i] ) {
	swap(B[i],B[cur0]);
	++cur0;
	if( i <= cur0 ) {
	  cur0 = 0;
	}
      } else if( A[i] != B[curn] && A[curn] != B[i] ) {
	swap(B[i],B[curn]);
	--curn;
	if( curn <= i ) {
	  curn = n - 1;
	}
      }
    }
    /*
    rep(j,n) {
      if( j ) printf(" ");
      cout << B[j];
    } puts("");
    */
    
  }
  bool ok = true;
  rep(i,n) if( A[i]==B[i]) { ok=false; }
  if( ok ) {
    myans = true;
    cout << YES << endl;
    rep(i,n) {
      if( i ) printf(" ");
      cout << B[i];
    } puts("");
  } else {
    cout << NO << endl;
  }
}



void solver5(int n,vector<int> A,vector<int> B) {
  sort(ALL(B));
  reverse(ALL(B));
  int cur = n-1;
  rep(i,n) {
    if( A[i] == B[i] ) {
      swap(B[i],B[cur]);
      --cur;
      if( cur <= i ) {
	cur = n - 1;
      }
    }
  }
  bool ok = true;
  rep(i,n) if( A[i]==B[i]) { ok=false; }
  if( ok ) {
    myans = true;
    cout << YES << endl;
    rep(i,n) {
      if( i ) printf(" ");
      cout << B[i];
    } puts("");
  } else {
    solver6(n,A,B);
  }
}


void solver4(int n,vector<int> A,vector<int> B) {
  sort(ALL(B));
  reverse(ALL(B));
  rep(i,n) {
    if( A[i] == B[i] ) {
      if( A[i] != B[0] ) {
	swap(B[i],B[0]);
      } else {
	swap(B[i],B.back());
      }
    }
  }
  bool ok = true;
  rep(i,n) if( A[i]==B[i]) { ok=false; }
  if( ok ) {
    myans = true;
    cout << YES << endl;
    rep(i,n) {
      if( i ) printf(" ");
      cout << B[i];
    } puts("");


  } else {
    solver5(n,A,B);
  }
}


void solver3(int n,vector<int> A,vector<int> B) {
  sort(ALL(B));
  reverse(ALL(B));
  rep(i,n) {
    if( A[i] == B[i] ) {
      swap(B[i],B.back());
    }
  }
  bool ok = true;
  rep(i,n) if( A[i]==B[i]) { ok=false; }
  if( ok ) {
    myans = true;
    cout << YES << endl;
    rep(i,n) {
      if( i ) printf(" ");
      cout << B[i];
    } puts("");
  } else {
    solver4(n,A,B);
  }
}

void solver2(int n,vector<int> A,vector<int> B) {
  sort(ALL(B));
  reverse(ALL(B));
  int cur = 0;
  rep(i,n) {
    if( A[i] == B[i] ) {
      swap(B[i],B[cur]);
    }
  }
  bool ok = true;
  rep(i,n) if( A[i]==B[i]) { ok=false; }
  if( ok ) {
    myans = true;
    cout << YES << endl;
    rep(i,n) {
      if( i ) printf(" ");
      cout << B[i];
    } puts("");
  } else {
    solver3(n,A,B);
  }
}

void solve(int n,vector<int> A,vector<int> B) {
  reverse(ALL(B));
  int cur = 0;
  rep(i,n) {
    if( A[i] == B[i] ) {
      swap(B[i],B[cur]);
      ++cur;
      if( cur >= i ) {
	cur = 0;
      }
    }
  }
  bool ok = true;
  rep(i,n) if( A[i]==B[i]) { ok=false; }
  if( ok ) {
    myans = true;
    cout << YES << endl;
    rep(i,n) {
      if( i ) printf(" ");
      cout << B[i];
    } puts("");
  } else {
    solver2(n,A,B);
  }
}

int main() {
  srand((unsigned int)time(NULL));
  /*
  REP(v1,1,4) {
    REP(v2,v1,4) {
      REP(v3,v2,4) {
	REP(v4,v3,4) {
	  REP(v5,v4,4) {
	    REP(v6,v5,4) {
	      REP(v11,1,4) {
		REP(v12,v11,4) {
		  REP(v13,v12,4) {
		    REP(v14,v13,4) {
		      REP(v15,v14,4) {
			REP(v16,v15,4) {
		  int n = 6;
		  vector<int> A(n);
		  A[0] = v1;
		  A[1] = v2;
		  A[2] = v3;
		  A[3] = v4;
		  A[4] = v5;
		  A[5] = v6;
		  vector<int> B(n);
		  B[0] = v11;
		  B[1] = v12;
		  B[2] = v13;
		  B[3] = v14;
		  B[4] = v15;
		  B[5] = v16;

		  myans = false;
		  ansB.clear();
		  solve(n,A,B);
		  sort(ALL(B));
		  bool enans = bf(n,A,B);
		  sort(ALL(B));
		  if( myans != enans ) {
		    cout << "*** failed ***" << endl;
		    cout << n << endl;
		    sort(ALL(B));
		    rep(i,n) {
		      cout << A[i] << " ";
		    } puts("");
		    rep(i,n) {
		      cout << B[i] << " ";
		    } puts("");
		  }
		  assert( myans == enans);
			}
		      }
		    }
		  }
		}
	      }
	    }
	  }
	}
      }
    }
  }
  return 0;
  */
  int n;
  cin >> n;
  vector<int> A(n), B(n);
  rep(i,n) cin >> A[i];
  rep(i,n) cin >> B[i];

  solve(n,A,B);
  /*
  cout << "Answer:" <<endl;
  bool bans = false;
  cout << ( (bans=bf(n,A,B))? YES : NO ) <<endl;
  if(bans) {
    rep(i,n) cout << ansB[i]<< " "; puts("");
  }
  */

  
  return 0;
}


Measured memory_bytes: 14344