1615 - Problem F. Party   

Description

It's the last day of summer camp for the freshmen of NTHU, so the organizer held a big party. There were in total 2n freshmen - n boys and n girls - who participated the party.
You, as a member of organizer, found an interesting fact: These freshmen tended to stand closer to the one he/she like. That is, during the party, every boy always moved himself to keep the girl he likes being closest to him(among these n girls); Similarly, every girls always moved herself to keep the boy she likes being closest to her(among these n boys).
There were another interesting fact that you'd already known: Due to the the romantic atmosphere of the party, a boy and a girl must become a couple when the camp was over if they liked each other.
You were very, very willing to know every gossip of these young schoolmates, so you took a snapshot of the party to record the positions of these freshmen. Can you _gure out how many couple there will be after the camp?

Input

The first line of input contains an integer T, the number of test cases in total.
There are three lines in each test case. The first line contains an integer n, the number of boys and girls in the party; The second line contains 2n integers (x1, y1), (x2, y2)… (xn, yn), where (xi, yi) is the coordination of i-th boy; The third line contains 2n integers (X1, Y1), (X2, Y2),…, (Xn, Yn), where (Xi; Yi) is the coordination of i-th girl.
It's ensured that no two people stood at same position. It's also ensured that every boy/girl liked exactly one girl/boy in the group, and there's no ambiguity - that is, for every boy/girl, there's only one girl/boy who was closest to him/her.
1<=T<=25
1<=N<=1000
-10000<=xi, yi, Xi, Yi<=10000

Output

You should output the answer (number of couples) in one line for each test case.

Sample Input  Download

Sample Output  Download

Tags




Discuss