# Structure and Class - Dice IV

Time Limit : 1 sec, Memory Limit : 65536 KB

# TCR IV

Dice I Ɠl̕@ŁA͂ꂽ $n$ ̃TCR܂B̃TCRASĈقȂ̂ǂ𔻒肷vO쐬ĂBꂩǂ̔ Dice III ̕@p܂B

## Input

PsڂɃTCŘ $n$ ^܂B $n$ sɊeTCR̖ʂ̐^܂B

eTCRɂĊeʂ̐Ax̏Ԃɋ󔒋؂łPsɗ^܂B

## Output

͂ꂽTCRׂĈقȂꍇ "Yes"ÂPgȏ܂܂ꍇ "No" ƂPsɏo͂ĂB

## Constraints

• $2 \leq n \leq 100$
• $0 \leq$ ͂TCR̖ʂ̐ $\leq 100$

3
1 2 3 4 5 6
6 2 4 3 5 1
6 5 4 3 2 1

No

3
1 2 3 4 5 6
6 5 4 3 2 1
5 4 3 2 1 6

Yes