The functional array of an array
is the array of size , where for . For example, if then .
You are given two arrays and of length and respectively. Find out whether there exists an array such that:
Output Format
For each test case, output a single line containing one word - either "YES" or "NO". You may print each character of the string in uppercase or lowercase (for example, the strings "yEs", "yes", "Yes" and "YES" will all be treated as identical).
Constraints
- The sum of over all test cases does not exceed
 - The sum of over all test cases does not exceed
 
Subtasks
Subtask #1 (5 points):
- The sum of over all test cases does not exceed
 
Subtask #2 (40 points):
- The sum of over all test cases does not exceed
 
Subtask #3 (55 points):
- Original constraints
 
Code: click
ConversionConversion EmoticonEmoticon