#C6576. Unique Follower-Following Pairs
Unique Follower-Following Pairs
Unique Follower-Following Pairs
Your task is to count the number of unique follower-following pairs in a set of follow operations. Each operation is represented by a pair of integers \( (a, b) \) which means that user a follows user b. Even if the same pair appears multiple times, it should be counted only once. Note that a user is allowed to follow themselves.
For each test case, the answer is the size of the set of unique pairs, i.e.:
$$ \text{result} = \left| \{ (a, b) \mid \text{each follow operation} \} \right|. $$inputFormat
The first line of input contains an integer \(T\) representing the number of test cases. Each test case is described as follows:
- The first line contains an integer \(N\), the number of follow operations.
- The next \(N\) lines each contain two space-separated integers \(a\) and \(b\), representing a follow operation where user \(a\) follows user \(b\).
outputFormat
For each test case, output a single line containing one integer — the number of unique follower-following pairs.
## sample2
3
1 2
1 2
2 3
4
5 6
5 6
5 6
6 5
2
2
</p>