Rikka with Bridges

i와 j 사이에 간선이 없고 둘 모두 k와 인접한 경우 (i,j,k)를 브리지라 할 때, 브리지가 K개 이하인 n개 정점의 무방향 그래프 개수를 m으로 나눈 나머지를 구한다.

어려움9조합론동적 계획법그래프수학아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Anthropoid sociology studies the interpersonal relationship of a group of people. We can abstract the relationship among nn people as an undirected graph G=V,EG = \langle V, E \rangle of nn vertices. An edge (i,j)E(i, j) \in E if and only if the ii-th person and the jj-th person are friends. We can analyze this graph in plenty of ways, and learn a lot of interesting facts about this group of people.

This semester, Rikka chose anthropoid sociology as an elective course, and her final project is studying relationship graphs. You know, if you want to get a higher GPA, you would better put a lot of time in the elective courses. So, Rikka works hard in this class, and she wants to finish an impressive project. 

Rikka is interested in the "bridges" in the graph. A tuple (i,j,k)(i, j, k) such that i<ji < j and ki,j)k \notin \\{i, j\\}) is a bridge if and only if (i,k)E(i, k) \in E, (j,k)E(j, k) \in E, but (i,j)E(i, j) \notin E. Informally, for a bridge (i,j,k)(i, j, k), the person kk will be a bridge for social contacts between ii and jj. The fewer bridges are there in a relationship graph, the more stable the group of people will be.

Rikka wants to study a student group in her college which has nn students in it. She wants to verify whether the group is stable enough, that is, whether the number of bridges in this group is less than or equal to KK. Rikka has not researched the relationships among the students yet. But she wants to make an estimate first. Since there are 2(n2)2^{\binom{n}{2}} possible relationship graphs, she wants to calculate the number of stable graphs among them. As this number can be rather large, it has to be calculated modulo a given number mm.

입력

The first line contains a single integer tt (1t1031 \leq t \leq 10^3), the number of test cases.

Each test case is given on a separate line containing three integers nn, KK, and mm (1n1031 \leq n \leq 10^3, 0K80 \leq K \leq 8, 108m109+710^8 \leq m \leq 10^9 + 7).

It is guaranteed that there are at most 5050 test cases with n>100n > 100.

출력

For each test case, print a single line with a single integer: the number of stable graphs modulo mm.