{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eHr0d1y has $$$q$$$ queries on a binary string $$$s$$$ of length $$$n$$$. A binary string is a string containing only characters \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003e0\u003c/span\u003e\u0027 and \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003e1\u003c/span\u003e\u0027.\u003c/p\u003e\u003cp\u003eA query is described by a pair of integers $$$l_i$$$, $$$r_i$$$ $$$(1 \\leq l_i \\lt r_i \\leq n)$$$. \u003c/p\u003e\u003cp\u003eFor each query, he has to determine whether there exists a good subsequence in $$$s$$$ that is equal to the substring $$$s[l_i\\ldots r_i]$$$. \u003c/p\u003e\u003cul\u003e \u003cli\u003e A substring $$$s[i\\ldots j]$$$ of a string $$$s$$$ is the string formed by characters $$$s_i s_{i+1} \\ldots s_j$$$.\u003c/li\u003e\u003cli\u003e String $$$a$$$ is said to be a subsequence of string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deleting some characters without changing the order of the remaining characters.\u003c/li\u003e\u003cli\u003e A subsequence is said to be \u003cspan class\u003d\"tex-font-style-bf\"\u003egood\u003c/span\u003e if it is not contiguous and has length $$$\\ge 2$$$. For example, if $$$s$$$ is \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e1100110\u003c/span\u003e\", then the subsequences $$$s_1s_2s_4$$$ (\"\u003cspan class\u003d\"tex-font-style-tt\"\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003e11\u003c/span\u003e0\u003cspan class\u003d\"tex-font-style-bf\"\u003e0\u003c/span\u003e110\u003c/span\u003e\") and $$$s_1s_5s_7$$$ (\"\u003cspan class\u003d\"tex-font-style-tt\"\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003e1\u003c/span\u003e100\u003cspan class\u003d\"tex-font-style-bf\"\u003e1\u003c/span\u003e1\u003cspan class\u003d\"tex-font-style-bf\"\u003e0\u003c/span\u003e\u003c/span\u003e\") are good, while $$$s_1s_2s_3$$$ (\"\u003cspan class\u003d\"tex-font-style-tt\"\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003e110\u003c/span\u003e0110\u003c/span\u003e\") is not good. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eCan you help Hr0d1y answer each query?\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of the input contains a single integer $$$t$$$ ($$$1\\leq t \\leq 100$$$)\u0026nbsp;— the number of test cases. The description of each test case is as follows.\u003c/p\u003e\u003cp\u003eThe first line contains two integers $$$n$$$ ($$$2 \\leq n \\leq 100$$$) and $$$q$$$ ($$$1\\leq q \\leq 100$$$)\u0026nbsp;— the length of the string and the number of queries. \u003c/p\u003e\u003cp\u003eThe second line contains the string $$$s$$$.\u003c/p\u003e\u003cp\u003eThe $$$i$$$-th of the next $$$q$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1 \\leq l_i \\lt r_i \\leq n$$$).\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, output $$$q$$$ lines. The $$$i$$$-th line of the output of each test case should contain \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eYES\u003c/span\u003e\" if there exists a good subsequence equal to the substring $$$s[l_i...r_i]$$$, and \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eNO\u003c/span\u003e\" otherwise.\u003c/p\u003e\u003cp\u003eYou may print each letter in any case (upper or lower).\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\n6 3\n001000\n2 4\n1 3\n3 5\n4 2\n1111\n1 4\n2 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\nNO\nYES\nNO\nYES\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first test case, \u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$s[2\\ldots 4] \u003d $$$ \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e010\u003c/span\u003e\". In this case $$$s_1s_3s_5$$$ (\"\u003cspan class\u003d\"tex-font-style-tt\"\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003e0\u003c/span\u003e0\u003cspan class\u003d\"tex-font-style-bf\"\u003e1\u003c/span\u003e0\u003cspan class\u003d\"tex-font-style-bf\"\u003e0\u003c/span\u003e0\u003c/span\u003e\") and $$$s_2s_3s_6$$$ (\"\u003cspan class\u003d\"tex-font-style-tt\"\u003e0\u003cspan class\u003d\"tex-font-style-bf\"\u003e0\u003c/span\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003e1\u003c/span\u003e00\u003cspan class\u003d\"tex-font-style-bf\"\u003e0\u003c/span\u003e\u003c/span\u003e\") are good suitable subsequences, while $$$s_2s_3s_4$$$ (\"\u003cspan class\u003d\"tex-font-style-tt\"\u003e0\u003cspan class\u003d\"tex-font-style-bf\"\u003e0\u003c/span\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003e1\u003c/span\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003e0\u003c/span\u003e00\u003c/span\u003e\") is not good. \u003c/li\u003e\u003cli\u003e $$$s[1\\ldots 3] \u003d $$$ \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e001\u003c/span\u003e\". No suitable good subsequence exists. \u003c/li\u003e\u003cli\u003e $$$s[3\\ldots 5] \u003d $$$ \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e100\u003c/span\u003e\". Here $$$s_3s_5s_6$$$ (\"\u003cspan class\u003d\"tex-font-style-tt\"\u003e00\u003cspan class\u003d\"tex-font-style-bf\"\u003e1\u003c/span\u003e0\u003cspan class\u003d\"tex-font-style-bf\"\u003e00\u003c/span\u003e\u003c/span\u003e\") is a suitable good subsequence. \u003c/li\u003e\u003c/ul\u003e"}}]}