Time limit
2s
Memory limit
128 MB
A teacher at an academy loves rock paper scissors. When students are caught being distracted during class, the teacher often decides whether to punish them through a prediction game.
One day, N students are caught at once. Since there are too many students, the teacher makes a new rule. The teacher will play rock paper scissors alone a total of M times, and each student predicts what the teacher will play on specific turns.
Each student may make up to two predictions. For example, a student can choose two turn-and-gesture pairs such as "scissors on the third turn and rock on the fourth turn." The student does not need both predictions to be correct; if at least one of the two is correct, that student avoids punishment.
The students have figured out the teacher's pattern and know that the teacher will not play paper that day. Therefore, on every turn the teacher can play only scissors or rock.
Given all students' predictions, determine whether there exists a sequence of gestures such that every student gets at least one prediction correct.
The first line contains two integers N and M. (1 <= N <= 10,000, 1 <= M <= 10,000)
Each of the next N lines contains two integers x and y, representing one student's two predictions. (1 <= |x|, |y| <= M)
If x is positive, it means the teacher plays scissors on turn x. If x is negative, it means the teacher plays rock on turn |x|. The value y is interpreted in the same way.
Print ^_^ if every student can get at least one prediction correct. Otherwise, print OTL.