A circuit checker has e constraints over wire nets, each net named by a single lowercase letter (a-z). Each constraint is exactly four characters: a net letter, then either == or !=, then another net letter. x==y means nets x and y must carry the same signal; x!=y means they must carry different signals.
Decide whether there is any assignment of signals to nets that satisfies every constraint. Print YES if one exists, otherwise NO.
Input format
- Line 1: an integer
e, the number of constraints. - Next
elines: one constraint each, of the formx==yorx!=y(four characters).
Output format
YES if all constraints can be satisfied simultaneously, otherwise NO.
Constraints
- 1 <= e <= 100000
- Every net name is a single lowercase English letter.