A string with length $L$ is called rich if $L \ge 3$ and there is a character which occurs in this string strictly more than $L/2$ times.
You are given a string $S$ and you should answer $Q$ queries on this string. In each query, you are given a substring $S_L, S_{L+1}, \ldots, S_R$. Consider all substrings of this substring. You have to determine whether at least one of them is rich.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains two space-separated integers $N$ and $Q$.
- The second line contains a single string $S$ with length $N$.
- Each of the next $Q$ lines contains two space-separated integers $L$ and $R$ describing a query.

-----Output-----
For each query, print a single line containing the string "YES" if the given substring contains a rich substring or "NO" if it does not contain any rich substring.

-----Constraints-----
- $1 \le T \le 10$
- $1 \le N, Q \le 10^5$
- $1 \le L \le R \le N$
- $S$ contains only lowercase English letters

-----Example Input-----
1
10 2
helloworld
1 3
1 10

-----Example Output-----
NO
YES

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '# from collections import Counter\n# class Node(object):\n#     def __init__(self, start, end):\n#         self.start = start\n#         self.end = end\n#         self.rich = None\n#         self.left = None\n#         self.right = None\n\n# class SegmentTree(object):\n#     def __init__(self):\n#         self.root = None\n \n#     def addToTree(self, l, r, string):\n#         node = Node(l,r)\n\n#         if r == len(string) - 1:\n#             self.root = Node(l,r)\n#             node = self.root\n  \n#         if r - l < 3:\n#             node.rich = False\n#             return node\n#         else:\n#             m = int((l+r)/2)\n#             left, right = self.addToTree(l, m, string), self.addToTree(m+1, r, \xa0\xa0\xa0\xa0string)\n#             node.weight = any()\n#             node.left = left\n#             node.right = right\n#             return node\n  \n# T = int(input())        \n# for _ in range(T):\n#     N, Q = map(int,input().split())\n#     string = input()\n#     ans = 1\n#     for __ in range(Q):\n#         L, R = map(int, input().split())\n#         if R-L >= 2:\n#             L -= 1\n#             sub_str = string[L:R]\n#             cnt = Counter(sub_str)\n#             for value in cnt.values():\n#                 if value > 2:\n#                     ans = 0\n#                     print(\'yes\')\n#                     break\n#         else:\n#             ans = 0\n#             print(\'no\')\n\n#         if ans:\n#             print(\'no\')\n\nt=int(input())\nfor _ in range(t):\n n,q=map(int,input().split())\n s=input()\n dp=[0]*(n+1)\n for i in range(n-2):\n  p=s[i:i+3]\n  if p.count(p[0])>=2 or p.count(p[1])>=2:\n   dp[i+1]=dp[i]+1\n  else:\n   dp[i+1]=dp[i]\n for _ in range(q):\n  l,r=map(int,input().split())\n  if n<3 or (r-l)<2:\n   print("NO")\n   continue\n  if dp[r-2]-dp[l-1]>0:\n   print("YES")\n  else:\n   print("NO")'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13433