We are given a graph with n vertices and m undirected edges. The edges are numbered in the order they are given in the input.
For every (i, j), for which 1 ≤ i ≤ j ≤ m, create a graph with n vertices and edges the edges of the original graph with indexes from i to j inclusively.
Find how many of these graphs are connected.