## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] Double Sort Codeforces Solution | Codeforces Problem Solution 2022

C. Double Sort
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given two arrays $a$ and $b$, both consisting of $n$ integers.

In one move, you can choose two indices $i$ and $j$ ($1\le i,j\le n$$i\ne j$) and swap ${a}_{i}$ with ${a}_{j}$ and ${b}_{i}$ with ${b}_{j}$. You have to perform the swap in both arrays.

You are allowed to perform at most ${10}^{4}$ moves (possibly, zero). Can you make both arrays sorted in a non-decreasing order at the end? If you can, print any sequence of moves that makes both arrays sorted.

Input

The first line contains a single integer $t$ ($1\le t\le 100$) — the number of testcases.

The first line of each testcase contains a single integer $n$ ($2\le n\le 100$) — the number of elements in both arrays.

The second line contains $n$ integers ${a}_{1},{a}_{2},\dots ,{a}_{n}$ ($1\le {a}_{i}\le n$) — the first array.

The third line contains $n$ integers ${b}_{1},{b}_{2},\dots ,{b}_{n}$ ($1\le {b}_{i}\le n$) — the second array.

Output

For each testcase, print the answer. If it's impossible to make both arrays sorted in a non-decreasing order in at most ${10}^{4}$ moves, print -1. Otherwise, first, print the number of moves $k$ $\left(0\le k\le {10}^{4}\right)$. Then print $i$ and $j$ for each move $\left(1\le i,j\le n$$i\ne j\right)$.

If there are multiple answers, then print any of them. You don't have to minimize the number of moves.