#Lutece1455. Master Zhu

Master Zhu

Migrated from Lutece 1455 Master Zhu

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

title

Input

There are multiple test cases. The first line of input contains an integer T, indicating the number of test cases.

For each test case,The first line contains two integers nn and mm (1n,m100)(1\le n,m\le 100) -- the number of rows and column. For the next n lines,each line two integers Li,Ri(1LiRim)L_i,R_i(1\le L_i\le R_i\le m).

Output

For each test case, output the min minimum number of chessmans he should place.

Samples

3

3 3
1 1
2 2
3 3

2 4
1 3
2 4

3 2
1 2
1 2
1 2
3
2
2

Resources

2016 Multi-University Training Contest 6