408283: GYM103076 F Big Day

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. Big Daytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Bini is a student from UFPE that lives a very busy life, as he studies during the day and works as a DJ during the night. One day, he was called by a famous song producer in Recife to participate in an interview with "ULULU", the biggest record label in Brazil.

Determined to impress the label in his big day, Bini decided to write a song with $$$n$$$ words to add to his playlist and make it less repetitive.

Because he is a very busy guy, Bini asked you to help him analyze and modify his song. To do this, he will ask $$$m$$$ queries of 3 types:

  • $$$1$$$ $$$i$$$ $$$j$$$ $$$c$$$ : change the j-th letter of the i-th word to charater c;
  • $$$2$$$ $$$i$$$ $$$j$$$ $$$L_i$$$ $$$R_i$$$ $$$L_j$$$ $$$R_j$$$ : answer if substring $$$[L_i, R_i]$$$ of the i-th word is equal to substring $$$[L_j, R_j]$$$ of the j-th word;
  • $$$3$$$ $$$i$$$ $$$j$$$ $$$L_i$$$ $$$R_i$$$ $$$L_j$$$ $$$R_j$$$ : answer if substring $$$[L_i, R_i]$$$ of the i-th word concatenated with substring $$$[L_j, R_j]$$$ of the j-th word forms a palindrome.

Your task is to answer all of Bini's queries, to help him in his big day, guaranteeing that he signs a big DJ contract.

Input

The first line of input contains two integers $$$n$$$ ans $$$q$$$ ($$$1 \le n, q \le 10^5$$$), the number of words in the song and the number of queries asked by Bini.

The next $$$n$$$ lines contain one word each, with the $$$i+1$$$ line containing the i-th word.

The next $$$q$$$ lines contain one query each, in the format specified above. It is guaranteed that all queries are valid and that at least one query will not be of type 1.

All the strings will consist only of lowercase Latin letters, and it's guaranteed that the sum of lengths of all the words in the input will not exceed $$$2*10^5$$$.

Output

For queries of type 2, print one line with the word "equal" if the substrings are equal and "different" if they are not.

For queries of type 3, print one line with the word "cool" if the resulting string is a palindrome and "not so cool" if it isn't.

ExampleInput
6 7
pao
de
batata
hummta
que
delicia
2 2 6 2 2 2 2
2 3 3 3 4 5 6
3 3 6 2 4 6 7
3 3 3 2 4 5 6
1 6 6 t
3 3 6 2 4 6 7
2 1 2 1 1 1 1
Output
equal
equal
not so cool
cool
cool
different
Note

A palindrome is a word that can be read both from right to left and from left to right without change, such as the words "ululu", "cc" and "o".

加入题单

算法标签: