#K76927. Critical Connection

    ID: 34751 Type: Default 1000ms 256MiB

Critical Connection

Critical Connection

In a network of stations connected by bidirectional paths, a connection (edge) is called a critical connection (or bridge) if its removal causes the network to become disconnected.

Given a network with (n) stations and (m) connections, determine whether there exists at least one critical connection. More formally, for an undirected graph (G=(V,E)), an edge ((u,v)) is a bridge if and only if removing it increases the number of connected components in (G).

For example, consider the network with 5 stations and the following connections:
1-2, 1-3, 2-4, 3-4, 4-5.
Removing the edge (4,5) disconnects station 5 from the rest of the network, which makes it a critical connection. Your task is to determine whether such a connection exists in the given network.

inputFormat

The input is read from standard input (stdin). The first line contains two integers (n) and (m), representing the number of stations and connections respectively. Each of the next (m) lines contains two integers (u) and (v), indicating that there is a bidirectional connection between station (u) and station (v).

outputFormat

Print a single line to standard output (stdout): "YES" if there exists at least one critical connection, otherwise print "NO".## sample

5 5
1 2
1 3
2 4
3 4
4 5
YES