#C7398. Unique Wizards Counting

    ID: 51264 Type: Default 1000ms 256MiB

Unique Wizards Counting

Unique Wizards Counting

In this problem, you are given a number of test cases. For each test case, you are provided with an integer \(n\) which represents the number of exchanges among wizards. Each exchange is represented by a pair of integers indicating the IDs of the two wizards involved. Your task is to determine the number of unique wizards involved in each test case.

Input Format:

The first line contains a single integer \(T\) denoting the number of test cases. Each test case begins with an integer \(n\), followed by \(n\) lines each containing two space-separated integers.

Output Format:

For each test case, output a single line containing the count of unique wizard IDs.

inputFormat

The first line of input consists of the integer \(T\), the number of test cases. For each test case, the first line contains an integer \(n\) (the number of exchanges). Each of the next \(n\) lines contains two space-separated integers representing the wizard IDs involved in an exchange.

outputFormat

For each test case, output a single integer on a new line representing the number of unique wizard IDs involved.

## sample
1
4
1 2
2 3
4 5
3 5
5

</p>