Who is taller?
InterviewTime limit1sMemory limit128 MB
Given comparisons stating x is taller than y, decide whether p is taller than q, q is taller than p, or neither is known.
Problem
You have a few minutes before your class starts, so you decide to compare the heights of your classmates. You don't have an accurate measuring device, so you only compare two people at a time: you stand them back-to-back and see which one is taller. Conveniently, no two classmates have exactly the same height, and you never make a mistake in a comparison.
After finishing all of your comparisons, you want to determine which of two particular classmates is taller.
Input
The first line contains two integers and separated by a single space. , the number of people in the class, satisfies . , the number of comparisons already made, satisfies .
Each of the next lines contains two distinct integers and () separated by a space, meaning that person was found to be taller than person .
The last line contains two distinct integers and () separated by a single space. Your goal is to determine, if possible, whether person is taller than person .
It is possible that neither nor appears in any comparison, and each comparison between a given pair of people is recorded exactly once.
Output
Print a single line containing one of the following three strings:
yes— if is taller than ,no— if is taller than ,unknown— if there is not enough information to determine the relative heights of and .