Under construction

Still being built. Things may change

Conversation Log

Interview

Time limit2sMemory limit256 MB

Summary
Find words used at least once by every user and list them by total frequency, breaking ties alphabetically.
Level

Easy3 of 10

Topics
Hash map, Sorting
Solved
No attempts yet

Problem

The social networking site My+Din has trouble managing its many popular forums. A recent regulation requires the site to report users who take part in conversations about certain topics. There are far too many users for manual monitoring, so the site asked its interns for a solution.

One intern guessed that a conversation about a given topic uses the same few words over and over. Knowing the most used words would tell investigators which forums to look at.

You are given the conversation log of one forum. Find the words that every single user of that forum used at least once.

Input

The first line contains one integer MM (1≤M≤1041 \le M \le 10^4), the number of messages.

Each of the next MM lines holds one message. A line starts with the user's name, which contains no spaces and is at most 20 characters long, and continues with the content of that user's message. The content is a list of words separated by spaces, every word consists of lower case letters, and each message contains at least one word. The total length of all messages, spaces included, is at most 2×1062 \times 10^6 characters. User names are case sensitive: two names belong to the same user only when the strings are identical. One user may post several messages.

Output

Print the words that every user of the forum used, one per line, ordered from most used to least used. Break ties alphabetically. The use count of a word is the number of times it appears across all messages, counting every repeat inside a message. If there is no such word, print ALL CLEAR.

Examples2

  1. Example 1

    Input
    8
    Jepson no no no no nobody never
    Ashley why ever not
    Marcus no not never nobody
    Bazza no never know nobody
    Hatty why no nobody
    Hatty nobody never know why nobody
    Jepson never no nobody
    Ashley never never nobody no
    
    Expected output
    no
    nobody
    never
    
  2. Example 2

    Input
    2
    Villain avast
    Scoundrel ahoy
    
    Expected output
    ALL CLEAR