文理学院程序设计在线练习


SameSequence?

Time Limit: 1 Second(s)    Memory Limit: 32 MB

Total Submission(s): 11   Accepted Submission(s): 7
Problem Description

John has a sequence S what only contains numbers. But John wants to change the sequence S to sequence T what looks more beautiful. John can choose the consecutive subsequence “s[i], s[i+1], …, s[j-1], s[j] (i<j)” and reverse it to “s[j], s[j-1], …, s[i+1], s[i]”. John can choose any consecutive subsequence and reverse them any times. Can John get the sequence T?

Input

The first line is an integer T (T<=20), representing the number of cases.
For each case, the first line contains an integer n (n<=50000), representing the length of sequence S and T. The second line contains n integers representing the sequence S. The third line contains n integers representing the sequence T.

Output

Output one line per case, either "Change" (without the quotes) if John can change the sequence S to T, or "No Way" (without the quotes) if not.

Sample Input
2
4
4 3 1 2
1 4 3 2
6
1 2 3 4 5 6
4 6 3 1 4 2
Sample Output
Change
No Way
Source

2018绍兴市联赛