Problem:
Find the number of intersections of the lines matching the two columns. The first line contains an integer T denoting the number of test-cases.
First line of each test-case contains an integer N denoting the number of elements in each column. N lines follow each containing a character c separated from a number n by a space character.
Sample Input:
1
8
A 3
B 2
C 8
D 1
E 6
F 7
G 4
H 5
Sample Output:
10
Explanation:
Solution: To come in following days.
Find the number of intersections of the lines matching the two columns. The first line contains an integer T denoting the number of test-cases.
First line of each test-case contains an integer N denoting the number of elements in each column. N lines follow each containing a character c separated from a number n by a space character.
Sample Input:
1
8
A 3
B 2
C 8
D 1
E 6
F 7
G 4
H 5
Sample Output:
10
Explanation:
Solution: To come in following days.