Welcome to ZOJ
124 - ZOJ Monthly, March 2013 - B
The Review Plan I

Time Limit: 5 Seconds      Memory Limit: 65536 KB

Michael takes the Discrete Mathematics course in this semester. Now it's close to the final exam, and he wants to take a complete review of this course.

The whole book he needs to review has N chapter, because of the knowledge system of the course is kinds of discrete as its name, and due to his perfectionism, he wants to arrange exactly N days to take his review, and one chapter by each day.

But at the same time, he has other courses to review and he also has to take time to hang out with his girlfriend or do some other things. So the free time he has in each day is different, he can not finish a big chapter in some particular busy days.

To make his perfect review plan, he needs you to help him.


There are multiple test cases. For each test case:

The first line contains two integers N(1≤N≤50), M(0≤M≤25), N is the number of the days and also the number of the chapters in the book.

Then followed by M lines. Each line contains two integers D(1≤DN) and C(1≤CN), means at the Dth day he can not finish the review of the Cth chapter.

There is a blank line between every two cases.

Process to the end of input.


One line for each case. The number of the different appropriate plans module 55566677.

Sample Input

4 3
1 2
4 3
2 1

6 5
1 1
2 6
3 5
4 4
3 4

Sample Output


Author: LI, Huang
Submit    Status