2454: Permutation

内存限制:128 MB 时间限制:3.000 S
评测方式:文本比较 命题人:
提交:0 解决:0

题目描述

bobo has a permutation p1,p2,…,pn of 1,2,…,n.

Knowing m extra constraints of form pai<pbi, bobo wanna count the number of different permutations modulo (109+7).

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,bi(1≤ai,bi≤n).

输出

For each tests:

A single number denotes the number of permutations.

样例输入 复制

3 1
1 2
3 2
1 2
2 3

样例输出 复制

3
1