Automated Program Analysis


Submit solution

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

Problem type
Allowed languages
Python
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

There are no comments at the moment.