406. Goggle

Time limit per test: 0.25 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard



Everybody knows search engine Goggle. But only advanced users know that it is possible to search number sequences. You can enter a set of numbers and the search engine will find all sequences which contain it. Goggle developers decided to improve the engine. New feature will help you if you know numbers which shouldn't be in the result. These numbers must be entered with the opposite sign. For example, if somebody enters "5 -3 6", the engine will find all the sequences which contain 5 and 6, but do not contain 3.

Help Goggle developers to implement the feature.

Input
The first line of the input will contain two integer numbers n and m (1 ≤ n ≤ 10, 1 ≤ m ≤ 10), where n is the number of sequences in Goggle database and m is the number of queries. Following n lines describe sequences in the Goggle database. The first integer k in each line is the length of the sequence (1 ≤ k ≤ 10). Next k numbers are the sequence elements. All of them are integers between 1 and 100, inclusive. Following m lines describe queries. The first integer l of each line is the numbers in query (1 ≤ l ≤ 10). Next l numbers bi are the sequence elements (1 ≤ |bi| ≤ 100, bi ≠ 0). These numbers have different absolute values.

Output
For each query print t — the number of found sequences on a separate line. Each of the next t lines should contain found sequence. The relative order of sequences should be preserved (in compliance with the input). The order of numbers in sequences should not change (in compliance with the input). Write sequences in format as they were given in the input.

Example(s)
sample input
sample output
3 5
6 1 2 3 1 2 3
4 3 2 4 5
2 4 2
3 1 2 3
2 3 2
3 2 -1 3
2 4 -2
2 4 5
1
6 1 2 3 1 2 3
2
6 1 2 3 1 2 3
4 3 2 4 5
1
4 3 2 4 5
0
1
4 3 2 4 5