Yet Another Sorting Problem!
题号:NC241121
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 1024 M,其他语言2048 M
Special Judge, 64bit IO Format: %lld

题目描述

There are N persons in Bytetown, with the i-th person having an item of type A_i. These persons want to exchange items with each other through the following operation:

  • Choose two persons , exchange the item owned by the i-th person and the j-th person.

They want to perform this operation exactly once between each pair of persons (i,j) with . At the end of this sequence of operations, the i-th person wants to own an item of type B_i. They want to know if there exists a sequence of operation achieving this requirement. Can you help them?

输入描述:

The first line contains an integer T (), denoting the number of test cases.

For each test case, the first line contains an integer , denoting the number of persons in Bytetown.

The second line contains N integers , where A_i denotes the item initially owned by the i-th person.

The third line contains N integers , where B_i denotes the item desired by the i-th person.

It is guaranteed that the sum of does not exceed .

输出描述:

For each test case, if there doesn't exist a sequence of operation achieving this requirement, output "NO"(without quotes) in a line. Otherwise, output "YES"(without quotes) in a line, then output a sequence of operation achieving the requirement in  lines, where the th line contains two integers i,j, denoting the k-th operation in the sequence.
示例1

输入

复制
2
2
1 2
1 2
2
2 1
1 2

输出

复制
NO
YES
1 2