#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
using namespace std;
const int maxn = 40;
int N;
int pre[maxn], post[maxn];
int in[maxn], num = 0;
int unique(int preL, int preR, int postL, int postR){
if(preL > preR) return 0;
if(preL == preR){
in[num++] = pre[preL];
return 1;
}
int i;
for(i = postL; i < postR; i++){
if(post[i] == pre[preL+1]) break;
}
int flag = 1;
flag &= unique(preL+1, preL+1+i-postL, postL, i);
in[num++] = pre[preL];
flag &= unique(preL+2+i-postL, preR, i+1, postR-1);
return flag;
}
int main() {
scanf("%d", &N);
for(int i = 0; i < N; i++){
scanf("%d", &pre[i]);
}
for(int i = 0; i < N; i++){
scanf("%d", &post[i]);
}
if(unique(0, N-1, 0, N-1)){
printf("Yes\n");
}else{
printf("No\n");
}
printf("%d", in[0]);
for(int i = 1; i < N; i++){
printf(" %d", in[i]);
}putchar('\n');
return 0;
}