Question
Robot Crate Stack Audit
A warehouse robot pushes crates in a fixed order and later pops them out. You are given the push order and a claimed pop order. Decide whether the claimed pop order could have happened using one stack.
Input
The first line contains KaTeX can only parse string typed expression. For each test case, the first line contains KaTeX can only parse string typed expression. The second line contains the pushed sequence. The third line contains the popped sequence.
Output
For each test case, print KaTeX can only parse string typed expression if possible, otherwise KaTeX can only parse string typed expression.
Example
Example 1:
Input
Example 2:
Input
Input
1
5
1 2 3 4 5
4 5 3 2 1OutputYESExample 2:
Input
1
5
1 2 3 4 5
4 3 5 1 2OutputNO