I have recently started studying graphs and their different traversal algorithms, and can't seem to be able to come up with an answer to this question. I really need your help, I don't even know where to start. P.S. It was my birthday yesterday and I don't want to cry because of this problem.

A company in New York manufactures blue halogen bulbs for cars. Unfortunately, it is very difficult to color bulbs consistently. Naturally, it is also very important to package bulbs that look alike in pairs. To package bulbs in pairs, bulbs coming out of the assembly line are first partitioned into two sets of bulbs sharing similar colors (e.g., one set of darker bulbs, another set of lighter bulbs), and then pairs are formed within each set.

Because of increasing demand, the company wishes to hire more workers to partition bulbs into two sets. To determine whether applicants have appropriate skills to perform this rather delicate task, they are asked to take this simple test: Given a set of n bulbs, compare each pair of bulbs and determine whether two bulbs have “similar” or “different” colors. An applicant also has an option to say “indeterminate” for each pair. The company wishes to hire applicants who are consistent in their judgment. We say m judgments (resulted in either “similar” or “different”) are consistent if it is possible to partition n bulbs into two sets such that (i) for each pair {a,b} determined to be “similar”, a and b indeed belong to the same set, and (ii) for each pair {a,b} determined to be “different”, a and b indeed belong to different sets.

For a given test result for n bulbs with m judgments, design an O(n+m)-time algorithm to determine whether the judgments are consistent. In practice, there should be a minimum number of judgments applicants are required to make, but your algorithm should work for any integer $m\ge 0$