3084SameSequence?

3084   SameSequence?

题目描述

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?

输入格式:

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 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.

输入样例 复制
2
4
4 3 1 2
1 4 3 2
6
1 2 3 4 5 6
4 6 3 1 4 2
输出样例 复制
Change
No Way

说明

14
37
通过提交
时空限制1000ms/128mb
题目来源
评测方式在线评测
题目类型
难        度