- Time limit: 1.00 s
- Memory limit: 512 MB
Uolevi has stumbled upon an ancient online feud. The feud is probably about that one TV show that has multiple endings since people are talking about little and big ends. There would seem to be a clear divide between little-endians and big-endians but Uolevi wishes to double check this fact by analyzing the like & dislike statistics.
There are users numbered on the site and dislikes/likes. The -th dislike/like was from user about user 's comment and was of type . If it was a like, then , otherwise . Uolevi wants to check whether the users can be split into two groups where the members of one group have only liked or received likes from their own group and only disliked or received dislikes from the opposite group. One of the groups may be empty.
Input
The first line contains two integers and . The -th of next following line contains three integers and .
Output
Print "Yes" if there is a clear division and "No" otherwise.
Constraints
- or
Example 1
Input:
5 7 4 5 1 1 3 1 1 4 -1 1 4 -1 4 5 1 2 4 -1 4 3 -1
Output:
Yes
Example 2
Input:
5 6 4 5 1 1 2 -1 1 2 1 2 1 1 2 4 1 5 3 -1
Output:
No