bobo has a permutation p1
Knowing m extra constraints of form pai
, bobo wanna count the number of different permutations modulo (109
It is guaranteed that there is at least one such permutation.
The input consists of several tests. For each tests:
The first line contains n,m (1≤n≤40,0≤m≤20). Each of the following m lines contain 2 integers ai
For each tests:
A single number denotes the number of permutations.