Songs

Time limit1sMemory limit128 MB

Problem

At the end of the year, a famous radio station announces a song ranking decided by listener votes over the year.

Instead of revealing the full ranking right away, the station holds a guessing contest. It releases hints about roughly where some songs sit in the ranking, and listeners must deduce the exact positions of as many songs as possible.

For example, suppose there are the following two hints.

  • The song Ti Da Bu Di Bu Da is among the top 3 songs.
  • The songs Treba mi nešto jače od sna and Ja se konja bojim are among the top 2 songs.

From these two hints alone, the order of the top 2 songs cannot be known. However, since the two songs in the second hint must take the top 2 spots, we can conclude that Ti Da Bu Di Bu Da is exactly at position 3.

Given the hints, print every song whose exact position in the ranking is certainly determined.

Input

The first line contains the number of hints N. (1 ≤ N ≤ 500)

Each of the next N lines contains a hint of the form A od B song1 song2 ... songA. This means that song1, song2, ..., songA are all within the top B songs. (1 ≤ A ≤ B ≤ 100)

Each song name is a single string of at most 20 lowercase English letters. The number of distinct songs appearing in the hints is at most 500.

The hints are mutually consistent, and at least one song whose exact position can be deduced always exists.

Output

Print every song whose exact position can be deduced. Print one song per line in the format position song, in increasing order of position.