문제
Farmer John has just arranged his
Problem credits: Nick Wu
입력
The first line contains
The next line contains
Each of the next
출력
You should write
예제
4 6
3 2 7 5
2 3
2 4
2 5
2 7
4 6
8 10
2
2
3
4
1
0
Farmer John has just arranged his
Problem credits: Nick Wu
The first line contains
The next line contains
Each of the next
You should write
4 6
3 2 7 5
2 3
2 4
2 5
2 7
4 6
8 10
2
2
3
4
1
0