Cycle in an Undirected Graph


Submit solution

Points: 100
Time limit: 2.0s
Memory limit: 256M

Author:
Problem types

Determine whether an undirected simple graph contains a cycle.

Input

The first line contains n and m. The next m lines contain undirected edges.

  • 1 <= n <= 1000

Output

Print 1 if a cycle exists; otherwise, print 0.

Example

Input
4 4
1 2
2 3
3 1
3 4
Output
1

Comments

There are no comments at the moment.