# Mapping

Time Limit : 1 sec, Memory Limit : 262144 KB

# B: ʑ

AORCJ͏W $S = \{a_1, ..., a_N\}$ Ǝʑ $f: SS$B$f(a_i) = b_i$ łB W $S$ ̔Cӂ̗vf $x$ ɂāA$g(f(x)) = h(f(x))$ 𖞂SĂ̎ʑ $g, h: SS$ A$g(x) = h(x)$ 𖞂ǂ肵AȂꍇ͔\B

• $1 \le N \le 10^5$
• $1 \le a_i,b_i \le N$
• $a_i \neq a_j \ (i \neq j)$
• ͂͑SĐ

## :

$N$
$a_1 \cdots a_N$
$b_1 \cdots b_N$

## o:

𖞂ꍇ
Yes

𖞂Ȃꍇ́A $g(a_i) = c_i, h(a_i) = d_i$ Ƃ
No
$c_1 \cdots c_N$
$d_1 \cdots d_N$

o͂B܂ɉso͂B

5
1 2 3 4 5
3 4 2 5 1

Yes

5
1 2 3 4 5
3 4 3 5 1

No
3 1 5 2 4
3 2 5 2 4