Pondo Compare


You are given a string ss of length nn and qq queries.

Each query gives four integers l1,r1,l2,r2l_1, r_1, l_2, r_2. Pondo wants to know whether the substring s[l1..r1]s[l_1 .. r_1] is lexicographically less than or equal to s[l2..r2]s[l_2 .. r_2] (1-indexed, inclusive).

A string aa is lexicographically smaller than bb if they first differ at a position where aa has the smaller character, or if aa is a proper prefix of bb.

Input

The first line contains two integers nn and qq.

The second line contains the string ss.

Each of the next qq lines contains four integers l1,r1,l2,r2l_1, r_1, l_2, r_2.

Output

Print qq lines. The ii-th line should be YES if s[l1..r1]s[l2..r2]s[l_1 .. r_1] \le s[l_2 .. r_2] for the ii-th query, and NO otherwise.

Constraints

  • 1n5×1051 \le n \le 5 \times 10^5
  • 1q1061 \le q \le 10^6
  • 1l1r1n1 \le l_1 \le r_1 \le n
  • 1l2r2n1 \le l_2 \le r_2 \le n
  • ss consists only of lowercase English letters.

Example 1

Input 1
10 4
abcdfabcde
1 5 6 10
1 4 6 9
1 10 1 10
6 9 1 5
Output 1
NO
YES
YES
YES
Explanation
  • abcdf is not less than or equal to abcde.
  • abcd is less than or equal to abcd.
  • abcdfabcde is less than or equal to itself.
  • abcd is a proper prefix of abcdf.

Example 2

Input 2
6 5
banana
2 6 1 6
1 3 4 6
2 4 5 6
1 6 1 6
3 3 2 2
Output 2
YES
NO
YES
YES
NO
Explanation
  • anana is smaller than banana.
  • ban is larger than ana.
  • ana is smaller than na.
  • banana is equal to itself.
  • n is larger than a.

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.