{"raw_statement":[{"iden":"statement","content":"Syrian Collegiate Programming Contest (SCPC) is the qualified round for the Arab Collegiate Programming Contest. Each year SCPC organizers face a problem that wastes a lot of time to solve it, it is about how should they arrange the teams in the contest hall.\n\nOrganizers know that they have t teams and n*m tables allocated in n rows and m columns in the contest hall. They don't want to put teams in a random way. Each year SCPC chief judge puts a list of paired teams (list of a,b teams) that should not sit next to each other (because they are so good or so bad!).\n\nif pair (a,b) is in chief judge list, this means that:\n\n- team number a should not sit in-front of team number b\n\n- team number b should not sit in-front of team number a\n\n- team number a should not sit right to team number b\n\n- team number b should not sit right to team number a\n\nOrganizers wastes a lot of time to find a good team arrangement that satisfy all chief judge needs. This year they are asking you to write a program that can help them.\n\nFirst line contains number of test cases. The first line in each test case contains three numbers: (1  ≤  n,m  ≤  11) and (1  ≤  t  ≤  10). Second line in each test case contains (0  ≤  p  ≤  40) number of pairs. Then there are p lines, each one of them has two team numbers a and b (1  ≤  a,b  ≤  t) where a is different than b.\n\nFor each test case, print one line contains the total number of teams arrangements that satisfy all chief judge needs (We guarantee that it will be less than 9,000,000 for each test case). If there is no suitable arrangements print \"impossible\".\n\nIn test case 1 there are 2 teams and 3 tables in one row at the contest hall. There are only one pair (1,2), so there are 2 solutions:\n\nteam1 then empty table then team2\n\nteam2 then empty table then team1\n\nIn test case 2 there are 4 tables in 2 rows and 2 columns, and there are 4 teams. There is no arrangement that can satisfy chief judge needs.\n\n"},{"iden":"input","content":"First line contains number of test cases. The first line in each test case contains three numbers: (1  ≤  n,m  ≤  11) and (1  ≤  t  ≤  10). Second line in each test case contains (0  ≤  p  ≤  40) number of pairs. Then there are p lines, each one of them has two team numbers a and b (1  ≤  a,b  ≤  t) where a is different than b."},{"iden":"output","content":"For each test case, print one line contains the total number of teams arrangements that satisfy all chief judge needs (We guarantee that it will be less than 9,000,000 for each test case). If there is no suitable arrangements print \"impossible\"."},{"iden":"examples","content":"Input21 3 211 22 2 421 21 3Output2impossible"},{"iden":"note","content":"In test case 1 there are 2 teams and 3 tables in one row at the contest hall. There are only one pair (1,2), so there are 2 solutions:team1 then empty table then team2team2 then empty table then team1In test case 2 there are 4 tables in 2 rows and 2 columns, and there are 4 teams. There is no arrangement that can satisfy chief judge needs."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ T_1, T_2, T_3 \\in \\mathbb{R}^2 $ be the vertices of a non-degenerate triangle (fort walls and towers).  \nLet $ P = \\text{conv}\\{T_1, T_2, T_3\\} $ be the triangular fort region.  \nLet $ N \\in \\mathbb{Z} $, $ 1 \\leq N \\leq 10 $, be the number of guards.  \n\n**Constraints**  \nEach guard independently and uniformly selects a point $ X_i \\in P $, $ i = 1, \\dots, N $.  \n\n**Objective**  \nCompute the probability that the convex hull of $ \\{X_1, \\dots, X_N\\} $ is an $ N $-gon (i.e., all points are vertices of the convex hull; no point lies in the convex hull of the others).","simple_statement":"Three towers form a triangle fort. N guards each randomly choose a point inside or on the border of the fort. What is the probability that all N guards form a convex N-gon (no guard is inside the convex hull of the others)?","has_page_source":false}