Rami, Yessine and Oussama recently participated on a competitive programming contest. And after finishing it, they were tired. So, to have some fun, they decided to go to the café at $$$\text{16:00}.$$$
Usually, Oussama is the first one to come, and he will always wait for Rami and Yessine to come $$$15$$$ to $$$30$$$ minutes late. But this time, Rami and Yessine are at the café and Oussama did not come yet.
As this situation is a little bit strange, Yessine called Oussama to check where he is, and of course, Oussama told him that he is ready, but he is just checking why his greedy solution was not accepted in the contest, and once he knows what is wrong with it, he will come.
Now, Yessine knows very well that this may take some time, so he invented a little challenge with Rami that will kill their time:
Rami was overwhelmed by the number of such questions, so he asked you to help him answer the question so that Yessine won't win the challenge.
1. The first line contains two integers $$$L,Q$$$ with $$$1\leq L\leq 10^5$$$ the length of the two strings, and $$$1\leq Q \leq 10^5$$$ the number of questions
2. The next two lines contain the lowercase alphabetic strings $$$A$$$ and $$$B$$$ respectively.
3. The next $$$Q$$$ lines contains each two integers, with the $$$i^\text{th}$$$ line having the parameters $$$1\leq l_i\leq r_i \leq L$$$
$$$Q$$$ lines, with the $$$i^\text{th}$$$ line equal to $$$\texttt{YES}$$$ if the two substrings $$$A[l_i\dots r_i]$$$ and $$$B[l_i\dots r_i]$$$ are co-sortable. Else output $$$\texttt{NO}.$$$
3 3 cbc adc 1 2 1 1 1 3
YES YES NO
For the first question, $$$A[1,2]=\text{cb}$$$ and $$$B[1,2]=\text{'ad'}.$$$ Initially they are not sorted, but by swapping $$$A[1]$$$ and $$$B[1]$$$ we will have $$$\text{'ab'}$$$ and $$$\text{'cd'}$$$ which are both sorted. So $$$A[1,2]$$$ and $$$B[1,2]$$$ are co-sortable.