Giorgio and Edoardo are talking about their favourite music genres, and the discussion is getting intense as they approach the trap music topic! Giorgio argues that trap lyrics are all the same, while Edoardo is a diehard fan of the genre and can’t tolerate such slander. In order to prove Giorgio wrong, he decided to measure how much his favourite trap song is original.
Thus, Edoardo collected the trap greatest hits, the first of which is his favourite. For each word of his favourite song, he wants to compute in how many other songs this word has already appeared, and then come back to Giorgio with the evidence collected this way, proving trap supremacy!
Input data
The first line contains the two integers and . Further lines follow, each describing the -th song through an integer (the number of words in the lyrics) followed by space-separated words (each composed of at most Latin lowercase letters a
to z
only).
Output data
You need to write a single line with integers: for each word of the first song, the number of other songs in which it appears.
Constraints and clarifications
- .
- .
- for each .
- Every word is comprised of at most Latin lowercase letters (
a
toz
).
# | Score | Constraints |
---|---|---|
1 | 0 | Examples |
2 | 12 | |
3 | 14 | |
4 | 27 | for each |
5 | 26 | |
6 | 21 | No additional limitations. |
Example 1
stdin
4 9
11 oh sfera sk sk skuh marseille milano oh oui bang bang
7 sfera ebbasta oh come un bang oh
4 amo milano oh sfera
5 sfera ti bang bang ebbasta
stdout
2 3 0 0 0 0 1 2 0 2 2
Explanation
In the first sample case, the word sfera
appears in all other songs, while oh
and bang
appear in other two songs. Finally, milano
only appears in one other song, and the other words are novel.
Example 2
stdin
5 7
14 che vi che mi avolta che qui dale merale merale dale avolta merale che
6 mi nisti nisti nisti mi mi
11 mi avolta che cele mi dale avolta cele dale cele mi
7 dale merale che che merale mi cele
8 merale merale cele avolta che dale avolta che
stdout
3 0 3 3 2 3 0 3 2 2 3 2 2 3