Problem K
Keyboard Queries
Katrín and her friends are university students, and they go
to a seminar every week. At the start of each seminar, the
professor divides the students into groups randomly. Katrín and
her friends dislike random groups, they want to form a group
together so they can chat with each other and not get to know
the other students. The professor has a secret string
There is a secret string
-
1 l r: This means that the substring of
at indices through is a palindrome. -
2 a b x y: This means that you should determine whether the substring at indices
though is equal to the substring at indices through , given the information in the previous queries.
Input
The first line of input contains two integers
The following
Output
For each query of the second kind print “Equal” if the substrings must be equal, “Not equal” if the substrings can’t be equal, and “Unknown” if either possibility could be true given the information thus far.
Sample Input 1 | Sample Output 1 |
---|---|
6 8 1 1 6 2 1 1 6 6 2 1 2 5 6 2 1 3 5 6 1 1 3 2 1 3 4 6 2 4 4 6 6 2 2 3 4 5 |
Equal Unknown Not equal Equal Equal Unknown |