Under construction

Still being built. Things may change

Cactus Determinant

Time limit0.4sMemory limit1024 MB

Summary
Given a connected cactus graph with up to 50000 vertices, find the determinant of its adjacency matrix modulo 993244853.
Level

Hard8 of 10

Topics
Graph, Tree, Dynamic programming, DFS
Solved
No attempts yet

Problem

A cactus graph is a simple connected undirected graph in which each edge belongs to at most one simple cycle.

The adjacency matrix of an NN-vertex graph is an N×NN \times N integer matrix where Ai,jA_{i,j} is 11 if there is an edge between vertices ii and jj, and 00 otherwise.

The determinant of an N×NN \times N matrix is defined as

∑p∈P(N)(−1)inv(p)(∏i=1NAi,pi)\sum_{p \in P(N)}(-1)^{inv(p)}\left(\prod_{i=1}^{N}A_{i,p_i}\right)

where P(N)P(N) is the set of all permutations of size NN, and inv(p)inv(p) is the number of pairs 1≤i<j≤N1 \le i < j \le N such that pi>pjp_i > p_j.

993244853 is a prime number that looks like 998244353=119×223+1998244353 = 119 \times 2^{23} + 1, but is actually not.

Find the determinant of the adjacency matrix of the given cactus graph, modulo 993244853.

Input

The first line contains NN and MM, the number of vertices and edges of the cactus graph. (1≤N≤500001 \le N \le 50000, 0≤M≤2500000 \le M \le 250000)

Each of the next MM lines contains two distinct integers ss and ee, the endpoints of an edge. (1≤s,e≤N1 \le s, e \le N, s≠es \neq e)

The graph is connected, has no loops or multiple edges, and each edge belongs to at most one simple cycle.

Output

Print the determinant of the adjacency matrix of the given cactus graph, modulo 993244853.

Examples3

  1. Example 1

    Input
    6 6
    2 3
    5 6
    2 5
    1 2
    3 4
    6 2
    
    Expected output
    993244852
    
  2. Example 2

    Input
    1 0
    
    Expected output
    0
    
  3. Example 3

    Input
    10 11
    1 2
    3 4
    1 3
    5 6
    7 8
    9 10
    7 9
    6 8
    1 9
    10 5
    4 9
    
    Expected output
    993244849