cf/mirror

Sorting Problem Again

CF
1982F2600· international gm2.5s256 MB⌨ stdin/stdout

Examples

Sample 1of 1
Input
2
5
2 2 3 4 5
3
2 1
4 1
1 1
5
1 2 3 4 5
9
1 4
2 3
5 2
3 1
1 1
5 1
4 1
3 1
2 1
Output
-1 -1
1 2
1 4
3 4
-1 -1
1 3
1 3
1 5
1 5
2 5
2 5
2 5
2 5
-1 -1
1982F.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)