#SDNU1230. Honest Village and Lie Village

Honest Village and Lie Village

Description

The Honest Village and The Lie Village’s story you should have heard of.You want to go to a village, the village is the honest village, all the people there are only to tell the truth, now in the way to go, encountered a fork in the road, the road to your destination honest village, and another road leads to another a village called lie village, where people are just lying. Now two men stood at the crossroads where (one of them come from honest village, another is from lie village,), you can ask them two honest village where the village road is determined to be honest, what would you ask them, how to distinguish the two of them who is from the honest village and who is from the lie village?

The method is just pointing to a village to ask two people: "Where are you from?" if that is honest village, two elderly people will say “yes”; if the answer is "no" means that is the lie village. This way can know which is the honest village.

Now change the question, there is a group of people in front of lmh, they are from honest village or lie village, and they know each other from where. lmhlmh can only ask someone from where (for example, A,BA, B two people, you can ask AA, where is BB from, if from honest village, then return to 11, or return to 00). AA and BB can be the same person. Now according to query to judge all the people come from which village, if you can, export all from honest village, otherwise output “nono”.

Format

Input

The first line has three non-negative integers nn, pp, and qq. nn is the number of questions you asked. pp and qq are the populations of the honest village and lie village. Each of the following nn lines has two integers xix_i, yiy_i and aia_i. xix_i and yiy_i are the identification numbers of inhabitants, each of which is between 11 and p+qp + q. (1n1000,1p+q300)(1 \leq n \leq 1000,1 \leq p+q \leq 300)

Output

For each data set, if it includes sufficient information to classify all people, print the identification numbers of all people from honest village in ascending order, one in a line. Otherwise, i.e.i.e., if a given data set does not include sufficient information to identify all people, print nono in a line.

Samples

2 2 1
1 2 1
2 3 0
3 2 1
1 1 1
2 2 1
3 3 1
1
2
no