Metro quiz#11747

Metro quiz

3 seconds
128 megabytes
Hard

Two spectators at the Olympic Games are waiting in a queue. Each of them has a copy of the Paris metro map, and they have invented a little game to pass the time. First, player thinks of one of the metro lines (choosing it uniformly at random among all lines), and player has to guess which line it is. To do this, player repeatedly asks whether the line stops at a station of his or her choice, and player truthfully answers each question. After a sufficient number of questions, player can usually determine for sure which line player had in mind. Of course, player wants to minimize the number of questions that need to be asked.

You are given a metro map describing lines (numbered from to ) and stations (numbered from to n-1). For each line, the stations where the train stops are listed. Calculate the expected number of questions player needs to ask to determine the hidden line, using the optimal strategy.

In other words, let be some strategy, and let Q_{S,j} denote the number of questions asked under strategy if the chosen line is . Then,

E_S = E[Q_S] = \frac{1}{m} \sum_{j=1}^m Q_{S,j}

denotes the expected value of Q_{S,j} when is chosen uniformly at random among all metro lines. Your task is to compute \min_S E_S. If it is not always possible for player to determine the chosen line with certainty, print not possible.

Input

The first line contains an integer (1 \leq n \leq 18), the number of stations. The second line contains an integer (1 \leq m \leq 50), the number of lines. Then follow lines: the -th of these lines contains first a positive integer p \leq n, then a space, and then integers s_1, s_2, \ldots, s_p — the numbers of the stations where the train of line stops. Each line stops at any given station at most once.

Output

Print one number: the minimum expected number of questions that player must ask in order to determine the chosen line, or not possible (in lowercase). Answers within 10^{-4} of the correct answer will be accepted.

Examples

Explanation for sample 2. It is optimal to ask about station first, due to the symmetry of the task. This distinguishes line , which stops at station , from lines and , which do not. If necessary, a second question can distinguish between lines and .

Player asks one question if the chosen line is line , and two questions otherwise. Thus, the expected number of questions is (1 + 2 \cdot 2)/3.

Example 1

Loading
Loading

Example 2

Loading
Loading