#K44152. Non-Intersecting Floral Arrangement

    ID: 27468 Type: Default 1000ms 256MiB

Non-Intersecting Floral Arrangement

Non-Intersecting Floral Arrangement

You are given n flowers arranged in a circle and m visual connections connecting pairs of these flowers. Each connection is represented as a chord between two flowers. Your task is to determine whether it is possible to arrange the flowers such that none of the connecting chords intersect.

A chord connecting two flowers represented by u and v is said to intersect with another chord connecting p and q if and only if their endpoints satisfy one of the following conditions in the circular order: $$u < p < v < q$$ or $$p < u < q < v.$$

If any two chords intersect as described above, then the arrangement is not possible. In that case, print "no"; otherwise, print "yes".

inputFormat

The first line contains two integers n and m, where n is the number of flowers and m is the number of visual connections. Each of the next m lines contains two integers representing a connection between two flowers.

You should read input from standard input (stdin).

outputFormat

Output a single line containing either "yes" if a non-intersecting arrangement of all connections exists, or "no" if it does not. The output should be printed to standard output (stdout).

## sample
4 4
1 2
2 3
3 4
4 1
yes