#K48617. Library Book Manager

    ID: 28461 Type: Default 1000ms 256MiB

Library Book Manager

Library Book Manager

In this problem, you are given a list of books and a sequence of operations to perform on that list. Each book is represented by an ISBN, a title, an author, and a publication year. You need to update the list of books by performing operations which can be one of the following:

  • (\texttt{add}): Append a new book to the list.
  • (\texttt{update}): Modify the details of an existing book identified by its ISBN.
  • (\texttt{delete}): Remove a book from the list based on its ISBN.

Your task is to process all the operations in the order given and print the final list of books. The order of the books in the output should preserve the order of appearance after all operations.

\textbf{Note:} All operations are guaranteed to have valid input parameters. If an update or delete operation references an ISBN that is not present in the list, you can ignore that operation.

inputFormat

The input is given via standard input (stdin) and has the following format:

  1. The first line contains an integer (n) representing the number of books in the initial list.

  2. The next (n) lines each contain the details of a book in the format:

    ISBN title author year

    (Each field is separated by a space. It is guaranteed that the title and author do not contain spaces.)

  3. The following line contains an integer (m) representing the number of operations.

  4. Each of the next (m) lines specifies an operation in one of the following formats:

    • For an add or update operation: (operation ISBN title author year)
    • For a delete operation: (operation ISBN)

Operations are processed sequentially.

outputFormat

Print the final list of books after all operations have been performed. Each book should be printed on a separate line in the same format as the input:

ISBN title author year

Output the books in the order they appear after processing all operations.## sample

2
12345 BookA Author1 2001
67890 BookB Author2 2002
1
add 11223 BookC Author3 2003
12345 BookA Author1 2001

67890 BookB Author2 2002 11223 BookC Author3 2003

</p>