Graph connectivity#4374

Graph connectivity

2 segundos
256 megabytes
Muy difícil

A connected undirected graph is given.

You will be given queries. Each query asks whether the graph will remain connected after removing a specified small set of edges.

Entrada

The first line contains two integers and (1 \leq N \leq 10000, 1 \leq M \leq 100000) — the number of vertices and the number of edges, respectively. The next lines each contain two integers and — the numbers of the vertices connected by the edge. The graph contains no loops or multiple edges. Vertices are numbered starting from . Edges are also numbered from in the input order.

The next line contains a single integer (1 \leq K \leq 100000), the number of queries. Each of the following lines contains a query. Each query starts with an integer (1 \leq C \leq 4) — the number of edges to remove, followed by distinct integers — the indices of the edges to remove.

Salida

For each query, output a single line. In the -th line, output Connected if the graph remains connected after removing the specified edges, and Disconnected otherwise.

Ejemplos

Ejemplo 1

Loading
Loading