#K1271. Common Stamps in Albums

    ID: 23751 Type: Default 1000ms 256MiB

Common Stamps in Albums

Common Stamps in Albums

You are given several test cases. In each test case there are multiple albums, and each album contains a list of stamp names. Your task is to determine the stamps that are common to all albums in a test case and output them in lexicographical order in a Python list representation format (i.e. using single quotes around stamp names). If there is no stamp common to all albums, output an empty list [].

Each album is provided as a line starting with an integer indicating the number of stamps followed by the stamp names. The stamps are non-empty strings that may consist of letters and/or digits.

inputFormat

The input consists of multiple test cases. The format is as follows:

T
For each test case:
    N
    k1 stamp1 stamp2 ... stamp_k1
    k2 stamp1 stamp2 ... stamp_k2
    ...
    kN stamp1 stamp2 ... stamp_kN

Where T is the number of test cases, N is the number of albums in that test case, and each album line starts with an integer k (the number of stamps) followed by k stamp names separated by spaces.

outputFormat

For each test case, print a single line containing a Python list representation of the common stamps sorted in lexicographical order. Each stamp should be enclosed in single quotes. If there is no stamp common to every album, output an empty list [].

## sample
3
3
3 aardvark alpha mango
4 banana alpha apple kiwi
2 alpha zebra
1
3 a b c
3
3 car bus bike
3 bus car train
3 bike bus car
['alpha']

['a', 'b', 'c'] ['bus', 'car']

</p>