help in solving problem

There are M manufacturers and each of them produce a range of products.

M1: [a1, b1]

M2: [a2, b2]

and so on…

Given a product ID, find how many manufacturers produce the given product.

Input Format

First line of input contains T - number of test cases.

  • The first line of each test case contains an integer M.
  • Next M lines contains the ith manufacturer’s range of product ids - starting(S) and ending(E) (both inclusive).
  • The next line contains Q - number of queries:
  • The next Q lines contains a single integer denoting the ID of the product.

Output Format

For each test case, print the number of merchants producing the given product for each query, separated by newline.

Constraints

1 <= T <= 100

1 <= M, Q <= 104

1 <= S <= E <= 109

1 <= ID <= 109

Example

Input 1

1 4 1 3 1 6 3 5 5 9 4 3 8 6 10

Output 1

3 1 2 0