logo AlgoBeat OnlineJudge
登录 注册

#213867. [CERC 2021] Cactus cutting

内存限制:256 MiB 时间限制:15000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Mr Malnar has given up on his tree obsession and found something even more interesting, cacti! Formally, a cactus is a connected graph where each edge is contained in at most one cycle. A cycle is defined as a sequence of more than one distinct edge in which every two consecutive edges share a common endpoint, and the first and last edge share a common endpoint as well.

Unfortunately, the cactus that Mr Malnar bought is rather big, so he would like to cut it up into disjoint sticks. One stick is defined as a pair of edges that share a common endpoint. Mr Malnar is a pedantic individual, so he wants to know the exact number of ways he can cut up his cactus into sticks.

输入格式

The first line contains the number of vertices and the number of edges . This is followed by lines, each containing two distinct integers and denoting an edge between vertices and . Each edge will be listed exactly once.

输出格式

Compute the number of distinct ways Mr Malnar can cut his cactus up into sticks. Since this number can get quite large, output the result modulo .

样例

样例输入 1

10 12
1 6
2 5
7 2
8 9
8 1
2 6
4 3
4 10
3 10
3 9
1 3
5 7

样例输出 1

8

数据范围与提示

Input limits