#C11528. Fully Connected Network

    ID: 40854 Type: Default 1000ms 256MiB

Fully Connected Network

Fully Connected Network

Given a network consisting of N computers and M direct connections between them, determine whether the network is fully connected. Two computers are considered connected if there exists a path (direct or indirect) between them. The network is fully connected if every computer can reach every other computer.

Formally, given a graph \(G(V, E)\) where \(V\) represents the computers and \(E\) represents the connections, the graph is fully connected if \(\forall u,v \in V, \exists\) a path from \(u\) to \(v\).

inputFormat

The input is given via standard input (stdin). The first line contains two integers \(N\) and \(M\), where \(N\) is the number of computers and \(M\) is the number of direct connections. Each of the following \(M\) lines contains two integers \(u\) and \(v\), representing a bidirectional connection between computer \(u\) and computer \(v\).

outputFormat

Output via standard output (stdout) a single line containing "Yes" if the network is fully connected, or "No" otherwise.

## sample
1 0
Yes