CCCGuide

Problem S4: Who is taller?

2013 · S4 · Original problem · DMOJ

Problem Description

You have a few minutes before your class starts, and you decide to compare the heights of your classmates. You don’t have an accurate measuring device, so you just compare relative heights between two people: you stand two people back-to-back, and determine which one of the two is taller. Conveniently, none of your classmates are the same height, and you always compare correctly (i.e., you never make a mistake in your comparisons).

After you have done all of your comparisons, you would like to determine who the tallest person is between two particular classmates.

Input Specification

The first line contains two integers NN and MM separated by one space. NN, the number of people in the class, is an integer with 1≤N≤10000001 \le N \le 1000000. MM, the number of comparisons that have already been done, is an integer with 1≤M≤100000001 \le M \le 10000000. Each of the next MM lines contains two distinct integers xx and yy (1≤x,y≤N1 \leq x, y \leq N) separated by a space, indicating that person number xx was determined to be taller than person number yy. Finally, the last line contains two distinct integers pp and qq (1≤p,q≤N1 \leq p, q \leq N) separated by one space: your goal is to determine, if possible, whether person pp is taller than person qq. Note that it may be the case that neither pp nor qq occur in the input concerning measurements between classmates, and each measurement between any two particular people will be recorded exactly once.

Output Specification

The output is one line, containing one of three possible strings:

Sample Input 1

10 3
8 4
3 8
4 2
3 2

Output for Sample Input 1

yes

Sample Input 2

10 3
3 8
2 8
3 4
3 2

Output for Sample Input 2

unknown