#C1518. Book Title Tracker

    ID: 44732 Type: Default 1000ms 256MiB

Book Title Tracker

Book Title Tracker

You are given a number of test cases. For each test case, you will be given an integer \( n \) representing the number of book titles, followed by \( n \) lines where each line contains a book title. Your task is to output each unique book title along with its frequency count in the order in which the titles first appear.

For each test case, print each unique book title and its corresponding count on a separate line, with a single space between the title and its count. Separate the outputs of different test cases with an empty line.

Example:

Input:
1
5
harrypotter
twilight
harrypotter
thehobbit
twilight

Output: harrypotter 2 twilight 2 thehobbit 1

</p>

Make sure your solution reads from standard input and writes to standard output.

inputFormat

The input begins with a single integer \( T \) denoting the number of test cases. For each test case, the first line contains an integer \( n \) representing the number of book titles. This is followed by \( n \) lines, each containing a book title (a string without spaces).

outputFormat

For each test case, output each unique book title and its count, in the order they first appear. Each title and its count should be printed on a new line, with a space separating the title and the count. Separate the outputs for different test cases with an empty line.

## sample
1
5
harrypotter
twilight
harrypotter
thehobbit
twilight
harrypotter 2

twilight 2 thehobbit 1

</p>