#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;

template <typename T> constexpr T inf;
template <> constexpr int inf<int> = 1e9;
template <> constexpr ll inf<ll> = 1e18;
template <> constexpr double inf<double> = 1e18;

int main() {
    int N; cin >> N;
    vector<int> a(N), b(N);
    set<int> bs;
    for(int i = 0; i < N; ++i) {
        cin >> a[i];
    }
    for(int i = 0; i < N; ++i) {
        cin >> b[i];
        bs.insert(b[i]);
    }
    if(bs.size() == N) {
        cout << "Yes" << endl;
    } else {
        int not_exist = -1;
        for(int i = 1; i <= N; ++i) {
            if(bs.count(i) == 0) {
                not_exist = i;
                break;
            }
        }
        vector<int> mapping(N); // map of d
        iota(begin(mapping), end(mapping), 1);
        if(not_exist == N) {
            mapping[N - 1] = 1;
        } else {
            mapping[not_exist - 1] = N;
        }
        
        cout << "No" << endl;
        for(int i = 0; i < N; ++i) { // c is id
            cout << a[i] << " \n"[i + 1 == N];
        }
        for(int i = 0; i < N; ++i) { // d
            cout << mapping[a[i] - 1] << " \n"[i + 1 == N];
        }
    }
}

### Prompt

Create a solution in Cpp for the following problem:

problem

AOR Ika made a set $ S = \\ {a_1, ..., a_N \\} $ and a map $ f: S → S $. $ f (a_i) = b_i $. For any element $ x $ in the set $ S $, all maps $ g, h: S → S $ satisfying $ g (f (x)) = h (f (x)) $ are $ g (x). ) = Determine if h (x) $ is satisfied, and if not, configure one counterexample.





Example

Input

5
1 2 3 4 5
3 4 2 5 1


Output

Yes

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;

template <typename T> constexpr T inf;
template <> constexpr int inf<int> = 1e9;
template <> constexpr ll inf<ll> = 1e18;
template <> constexpr double inf<double> = 1e18;

int main() {
    int N; cin >> N;
    vector<int> a(N), b(N);
    set<int> bs;
    for(int i = 0; i < N; ++i) {
        cin >> a[i];
    }
    for(int i = 0; i < N; ++i) {
        cin >> b[i];
        bs.insert(b[i]);
    }
    if(bs.size() == N) {
        cout << "Yes" << endl;
    } else {
        int not_exist = -1;
        for(int i = 1; i <= N; ++i) {
            if(bs.count(i) == 0) {
                not_exist = i;
                break;
            }
        }
        vector<int> mapping(N); // map of d
        iota(begin(mapping), end(mapping), 1);
        if(not_exist == N) {
            mapping[N - 1] = 1;
        } else {
            mapping[not_exist - 1] = N;
        }
        
        cout << "No" << endl;
        for(int i = 0; i < N; ++i) { // c is id
            cout << a[i] << " \n"[i + 1 == N];
        }
        for(int i = 0; i < N; ++i) { // d
            cout << mapping[a[i] - 1] << " \n"[i + 1 == N];
        }
    }
}

```