atcoder#ABC213G. [ABC213G] Connectivity 2
[ABC213G] Connectivity 2
Score : points
Problem Statement
Given is a simple undirected graph with vertices and edges. The vertices are numbered , the edges are numbered , and Edge connects Vertex and Vertex . Consider removing zero or more edges from to get a new graph . There are graphs that we can get as . Among them, find the number of such graphs that Vertex and Vertex are directly or indirectly connected, for each integer such that . Since the counts may be enormous, print them modulo .
Constraints
- if .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the answer for .
3 2
1 2
2 3
2
1
We can get the following graphs as .
- The graph with no edges. Vertex is disconnected from any other vertex.
- The graph with only the edge connecting Vertex and . Vertex is reachable from Vertex .
- The graph with only the edge connecting Vertex and . Vertex is disconnected from any other vertex.
- The graph with both edges. Vertex and are reachable from Vertex .
5 6
1 2
1 4
1 5
2 3
2 5
3 4
43
31
37
41
2 0
0