{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\n \u003cdiv\u003e\n Bobo has a balanced parenthesis sequence P\u003dp\n \u003csub\u003e1\u003c/sub\u003e p\n \u003csub\u003e2\u003c/sub\u003e…p\n \u003csub\u003en\u003c/sub\u003e of length n and q questions.\n \u003c/div\u003e \n \u003cdiv\u003e\n The i-th question is whether P remains balanced after p\n \u003csub\u003eai\u003c/sub\u003e and p\n \u003csub\u003ebi\u003c/sub\u003e \u0026nbsp;swapped. Note that questions are individual so that they have no affect on others.\n \u003c/div\u003e \n \u003cdiv\u003e\n Parenthesis sequence S is balanced if and only if:\n \u003c/div\u003e \n \u003cdiv\u003e\n 1.\n \u003cspan class\u003d\"Apple-tab-span\" style\u003d\"white-space:pre\"\u003e \u003c/span\u003eS is empty;\n \u003c/div\u003e \n \u003cdiv\u003e\n 2.\n \u003cspan class\u003d\"Apple-tab-span\" style\u003d\"white-space:pre\"\u003e \u003c/span\u003eor there exists \n \u003cem\u003ebalanced \u003c/em\u003eparenthesis sequence A,B such that S\u003dAB;\n \u003c/div\u003e \n \u003cdiv\u003e\n 3.\n \u003cspan class\u003d\"Apple-tab-span\" style\u003d\"white-space:pre\"\u003e \u003c/span\u003eor there exists \n \u003cem\u003ebalanced \u003c/em\u003eparenthesis sequence S\u0027 such that S\u003d(S\u0027).\n \u003c/div\u003e\n \u003c/body\u003e\n\u003c/html\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\n \u003cdiv\u003e\n The input contains at most 30 sets. For each set:\n \u003c/div\u003e \n \u003cdiv\u003e\n The first line contains two integers n,q (2≤n≤10\n \u003csup\u003e5\u003c/sup\u003e,1≤q≤10\n \u003csup\u003e5\u003c/sup\u003e).\n \u003c/div\u003e \n \u003cdiv\u003e\n The second line contains n characters p\n \u003csub\u003e1\u003c/sub\u003e p\n \u003csub\u003e2\u003c/sub\u003e…p\n \u003csub\u003en\u003c/sub\u003e.\n \u003c/div\u003e \n \u003cdiv\u003e\n The i-th of the last q lines contains 2 integers a\n \u003csub\u003ei\u003c/sub\u003e,b\n \u003csub\u003ei\u003c/sub\u003e (1≤a\n \u003csub\u003ei\u003c/sub\u003e,b\n \u003csub\u003ei\u003c/sub\u003e≤n,a\n \u003csub\u003ei\u003c/sub\u003e≠b\n \u003csub\u003ei\u003c/sub\u003e).\n \u003c/div\u003e \n \u003cp\u003e\u003c/p\u003e\n \u003c/body\u003e\n\u003c/html\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\n \u003cdiv\u003e\n For each question, output \"\n \u003cem\u003eYes\u003c/em\u003e\" if P remains balanced, or \"\n \u003cem\u003eNo\u003c/em\u003e\" otherwise.\n \u003c/div\u003e\n \u003c/body\u003e\n\u003c/html\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e4 2\n(())\n1 3\n2 3\n2 1\n()\n1 2\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003eNo\nYes\nNo\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\u003c/body\u003e\n\u003c/html\u003e"}}]}