#K46227. Book Search

    ID: 27930 Type: Default 1000ms 256MiB

Book Search

Given a list of books and a list of queries, your task is to find the books written by a specified author that were published within a given year range. For each query, output the matching books sorted in ascending order of publication year. Each book should be formatted as Title, Year. If no books are found for a query, output No books found.

All input is read from standard input and all output should be written to standard output.

inputFormat

The input begins with an integer n representing the number of books. Each of the next n lines contains details of a book in the format:

Title, Author, Year

(Fields are separated by a comma followed by a space.)

The next line contains an integer q representing the number of queries. Each of the following q lines contains a query in the format:

Author, Start_Year, End_Year

For each query, you must find all books whose author exactly matches the given Author and whose Year is in the inclusive range [Start_Year, End_Year].

outputFormat

For each query, output a single line. If matching books are found, print them in ascending order of Year, separated by '; ', where each book is shown in the format Title, Year. If no books match the query, output No books found.## sample

4
The Great Gatsby, F. Scott Fitzgerald, 1925
Tender Is the Night, F. Scott Fitzgerald, 1934
1984, George Orwell, 1949
Animal Farm, George Orwell, 1945
1
George Orwell, 1940, 1950
Animal Farm, 1945; 1984, 1949

</p>