

1. NameOfAuthor1
A. Book1
B. Book2
2. NameOfAuthor2
A. Book1
The first line of input contains an integer ‘T' representing the number of test cases.
The first line of each test case contains one integer, ‘N’ denoting the number of authors.
The next N’ lines contain a stream of strings, where the first token is an integer ‘M’ denoting the number of books, the second token is the ‘NameOfAuthor’ and the other space-separated strings are the ‘Books’ written by the author.
For each test case, you need to print an array of strings in which the first index of the array is the ‘NameOfAuthor1’ followed by the ‘Books’ written by this author(each book should be a separate string in the array) and the next index is the ‘NameOfAuthor2’ and the next indexes are the ‘Books’ written by this author and so on.
Don’t care about indentation. It has been taken care of. But, the labels matter here.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 1000
1 <= |S| <= 100
1 <= Number of books by each author <= 26
Time limit: 1 sec
The idea is to use an array of strings, which stores the information about the authors and the books written by them. Now, just iterate through the 2D array S and form the ans according to the rules mentioned.