문제
Bessie and Elsie have each baked
Bessie is thinking about giving one of her pies to Elsie. If Elsie receives a pie from Bessie, she will feel obligated to give one of her pies to Bessie. So as to not appear stingy nor flamboyant, Elsie will try to pick a pie that is at least as tasty (in Elsie's eyes) as the pie she received, but no more than
But if Elsie does give Bessie a pie in return, Bessie will similarly try to give Elsie a pie which is at least as tasty but no more than
Note that a pie may not be gifted twice, nor can either cow return a pie gifted to her.
For each of the
Problem credits: Dhruv Rohatgi
입력
The first line contains the two integers
The next
The first
It is guaranteed that all tastiness values are in the range
출력
There should be
예제
2 1
1 1
5 0
4 2
1 4
3
1