#438. Restore Atlantis II

Restore Atlantis II

Description

There are nn ancient Greek maps describing the fabled islands Atlantis. The maps are labeled by 1,2,,n1,2,\dots,n. The ii-th map shows the rectangle area RiR_i is a part of Atlantis. The sides of all rectangles are parallel to the axes. There may be multiple islands, and the rectangles may overlap.

Unfortunately, some maps are even unreliable so they will not be considered. You will be given qq queries. In the ii-th query, you will be given two integers sis_i and tit_i (1sitin1\leq s_i\leq t_i\leq n). Please write a program to figure out the total area of Atlantis when only maps labeled by kk (siktis_i\leq k\leq t_i) are reliable.

Format

Input

The first line contains a single integer TT (1T31 \leq T \leq 3), the number of test cases. For each test case:

The first line of the input contains two integers nn and qq (1n,q1000001 \leq n,q \leq 100\,000), denoting the number of maps and the number of queries.

In the next nn lines, the ii-th line contains four integers xaixa_i, yaiya_i, xbixb_i and ybiyb_i (0xai<xbi1090\le xa_i<xb_i\leq 10^9, 0yai<ybi1090\le ya_i<yb_i\leq 10^9), describing the ii-th map RiR_i. (xai,yai)(xa_i,ya_i) is the southwest corner of RiR_i, and (xbi,ybi)(xb_i,yb_i) is the northeast corner of RiR_i.

In the next qq lines, the ii-th line contains two integers sis_i and tit_i (1sitin1\leq s_i\leq t_i\leq n), describing the ii-th query.

It is guaranteed that all the values of xaixa_i, yaiya_i, xbixb_i, ybiyb_i, sis_i and tit_i are chosen uniformly at random from integers in their corresponding ranges. The randomness condition does not apply to the sample test case, but your solution must pass the sample as well.

Output

For each query, print a single line containing an integer, denoting the total area using the information of all reliable maps in this query.

Samples

1
3 6
10 10 20 20
12 12 22 22
15 15 25 25
1 1
2 2
3 3
1 2
2 3
1 3
100
100
100
136
151
187