SP26344 NINJA1 - Related or not

Description

Problem statement: You are given two DNA sequences A and B. It is said that these two DNA sequences are related if there exists a non-decreasing sequence C of the same length, such that C $ _{i} $ **=** A $ _{i} $ or C $ _{i} $ = B $ _{i} $ . Find if the given sequences are related. Input format: The first line contains an integer, T, the number of test cases. For each test case: The first line contains an integer,N, the length of the DNA sequence. The second line contains a sequence of space-separated integers describing species A. The third line contains a sequence of space-separated integers describing species B. **Output Format** On a new line for each test case, print **YES** if a non-decreasing sequence of the same length can be found or **NO** if it cannot. Constraints: 1 1

Input Format

N/A

Output Format

N/A