#C13082. Graph Connectivity Check

    ID: 42581 Type: Default 1000ms 256MiB

Graph Connectivity Check

Graph Connectivity Check

Given an undirected graph, determine whether it is connected. The graph is provided with n nodes labeled from 0 to n-1 and m edges. A graph is considered connected if there exists a path between every pair of vertices. In other words, the graph is connected if and only if $$|visited| = n$$, where n is the number of vertices.

Note that an empty graph (n = 0) is defined to be connected.

inputFormat

The first line of input contains two integers n and m, representing the number of nodes and the number of edges, respectively. The nodes are labeled from 0 to n-1.

Each of the following m lines contains two integers u and v (0 ≤ u, v < n), indicating that there is an undirected edge between nodes u and v.

outputFormat

Print True if the graph is connected, and False otherwise. The output should be printed to stdout.

## sample
1 0
True

</p>