PivotOJ

Keyboard Queries

시간 제한: 1000ms메모리 제한: 1024MB출처: NCPC 2022BOJ 26034

문제

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 SS consisting of nn characters on their computer. This string acts as a seed for the random group generation. When generating groups, a program manager is ran with a substring of SS as input. But sometimes, the professor mistypes and writes manacher instead. This will indicate that the substring is a palindrome. Maybe Katrín can use this information to predict what the group division will look like?

There is a secret string SS with nn characters in an unknown alphabet. You are given qq queries of two types.

  • 1 l r: This means that the substring of SS at indices ll through rr is a palindrome.
  • 2 a b x y: This means that you should determine whether the substring at indices aa though bb is equal to the substring at indices xx through yy, given the information in the previous queries.

입력

The first line of input contains two integers nn and qq (1n1051 \leq n \leq 10^5, 1q21051 \leq q \leq 2 \cdot 10^5), the number of characters in the unknown string and the number of queries.

The following qq lines each start with a 11 or a 22 indicating the type of query. For queries of type 11, two integers ll and rr follow (1lrn1 \leq l \leq r \leq n), meaning that the corresponding substring of SS is a palindrome. For queries of type 22, four integers a,b,x,ya,b,x,y follow (1abn1 \leq a \leq b \leq n, 1xyn1 \leq x \leq y \leq n), meaning that you should determine whether those two substrings are equal or not.

출력

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.

예제

예제 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
코드를 제출하려면 로그인하세요.