Ariel
King Triton really likes watching sport competitions on TV. But much more Triton likes watching live competitions. So Triton decides to set up a swimming competition in the kingdom Merfolk. Thousands of creatures come to take part in competition, that’s why it is too difficult to take the first place.
For the King’s beloved daughter Ariel this competition is the first in her life. Ariel is very kind, so she wants to give a lot of gold medals. Ariel says, that it is unfair to make a single ranking list for creatures that are so different. It is really a good result to be the fastest small fish without tail in Merfolk!
Ariel chooses k important traits (such as size, tailness, rapacity and so on). A creature can either possess a trait or not (there are no intermediate options).
A score is given for each creature (it doesn’t matter how it was calculated) and the list of possessed traits f_1, ..., f_y is also given.
Ariel wants to know the place occupied by creature a in a competition among creatures, who have the same traits h_1, ..., h_t. So if creature a doesn’t have a trait h_i, then all creatures in the competition are without this trait. If creature ahas a trait h_i, then all creatures in the competition have this trait. Other traits doesn’t matter. The winner of the competition is a creature with the maximum score.
Input
The first line contains n (1 ≤ n ≤ 10^4) and k (1 ≤ k ≤ 10). The next n lines contain information about creatures:score (1 ≤ score ≤ 10^9), y (0 ≤ y ≤ k) — the number of possessed traits, and y numbers f_i (1 ≤ f_i ≤ k) — ids of possessed traits. All f_i in one line are different.
The next line contains m (1 ≤ m ≤ 10^5) — the number of queries from Ariel. The next m lines describe queries: a (1≤ a ≤ n) — the id of a creature, then t — the number of traits, then t numbers h_i. All h_i in one line are different.
Output
For each query output the place of a creature a in ranking list amount the corresponded creatures. If several creatures have the same score all of them take the same place.