Automated Program Analysis
n lines each contain three integers i, j, e, describing one equality/inequality constraint. Adjacent integers are separated by a single space.
- If e = 1, the constraint is xi = xj.
- If e = 0, the constraint is xi ≠ xj.
Output Format
Output t lines.
The k-th line of output should be YES if the k-th problem is satisfiable, otherwise NO.
Data Range
1 ≤ t ≤ 10
1 ≤ n ≤ 105
1 ≤ i, j ≤ 109
Input Sample:
2
2
1 2 1
1 2 0
2
1 2 1
2 1 1
Output Sample:
NO
YES
Comments