#include <bits/stdc++.h>
using namespace std;
int N;
vector<pair<int, int> > ab;
vector<int> exist(N, false);
void solve() {
  vector<int> g(N), h(N);
  for (int i = 0; i < N; i++) {
    g[i] = i;
    h[i] = i;
    if (exist[i] == false) {
      h[i] = i + 1;
    }
  }
  for (int i = 0; i < N; i++) {
    if (i != 0) cout << " ";
    cout << g[i] + 1;
  }
  cout << endl;
  for (int i = 0; i < N; i++) {
    if (i != 0) cout << " ";
    cout << h[i] + 1;
  }
  cout << endl;
}
int main(void) {
  cin >> N;
  ab = vector<pair<int, int> >(N);
  for (int i = 0; i < N; i++) {
    cin >> ab[i].first;
    ab[i].first--;
  }
  for (int i = 0; i < N; i++) {
    cin >> ab[i].second;
    ab[i].second--;
  }
  exist = vector<int>(N, false);
  bool flg = false;
  for (int i = 0; i < N; i++) {
    int b = ab[i].second;
    if (exist[b] == true) {
      flg = true;
    } else {
      exist[b] = true;
    }
  }
  if (flg == false) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
    solve();
  }
  return 0;
}
