Problem H: GPA

Problem H: GPA

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 111  Solved: 12
[Submit][Status][Web Board]

Description

Yuki is a clever girl and she is a teaching secretary in the department of computer science and engineering (CSE).

There are totally \(n\) students in the department of CSE. One day Yuki is asked to give the full rank list (based on their GPA, where students with the same GPA have the same rank) of these students. However, due to her carelessness, their exact GPA values are missing and only some messages remained. To be specific, there are \(m\) messages remained, each message can be described in one of the following three forms: A<B, A=B or A>B, that is the GPA of student \(A\) is less, equal to or greater than \(B\).

Now Yuki wants to know, based on these \(m\) messages, whether she can obtain the unique full rank list of these students.

Input

The first line contains two integers: \(n\) and \(m\) \((1 ≤ n ≤ 100\ 000,\ 1 \leq m \leq 200\ 000)\) — the number of students in CSE and the number of messages.

Each of the next \(m\) lines contains a message about their GPA.

Output

Output one line with the result.

If she can obtain the unique full rank list, print “Yes”. Otherwise, print “No” (without quotation).

Sample Input

4 4
1 > 2
1 > 3
2 > 4
3 > 4

Sample Output

No

HINT

The rank list for the sample data may be \((1, 2, 3, 4)\) or \((1, 3, 2, 4)\), which is not unique.
You are strongly recommended to learn how to use Disjoint-set data structure before trying to solve this problem.

[Submit][Status]