{"trustable":true,"prependHtml":"\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 async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eConflicts are everywhere in the world, from the young to the elderly, from families to countries. Conflicts cause quarrels, fights or even wars. How wonderful the world will be if all conflicts can be eliminated.\u003cbr\u003eEdward contributes his lifetime to invent a \u0027Conflict Resolution Terminal\u0027 and he has finally succeeded. This magic item has the ability to eliminate all the conflicts. It works like this:\u003cbr\u003eIf any two people have conflict, they should simply put their hands into the \u0027Conflict Resolution Terminal\u0027 (which is simply a plastic tube). Then they play \u0027Rock, Paper and Scissors\u0027 in it. After they have decided what they will play, the tube should be opened and no one will have the chance to change. Finally, the winner have the right to rule and the loser should obey it. Conflict Eliminated!\u003cbr\u003eBut the game is not that fair, because people may be following some patterns when they play, and if the pattern is founded by others, the others will win definitely.\u003cbr\u003eAlice and Bob always have conflicts with each other so they use the \u0027Conflict Resolution Terminal\u0027 a lot. Sadly for Bob, Alice found his pattern and can predict how Bob plays precisely. She is very kind that doesn\u0027t want to take advantage of that. So she tells Bob about it and they come up with a new way of eliminate the conflict:\u003cbr\u003eThey will play the \u0027Rock, Paper and Scissors\u0027 for N round. Bob will set up some restricts on Alice.\u003cbr\u003eBut the restrict can only be in the form of \"you must play the same (or different) on the ith and jth rounds\". If Alice loses in any round or break any of the rules she loses, otherwise she wins.\u003cbr\u003eWill Alice have a chance to win?\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains an integer T(1 \u0026lt;\u003d T \u0026lt;\u003d 50), indicating the number of test cases.\u003cbr\u003eEach test case contains several lines.\u003cbr\u003eThe first line contains two integers N,M(1 \u0026lt;\u003d N \u0026lt;\u003d 10000, 1 \u0026lt;\u003d M \u0026lt;\u003d 10000), representing how many round they will play and how many restricts are there for Alice.\u003cbr\u003eThe next line contains N integers B\u003csub\u003e1\u003c/sub\u003e,B\u003csub\u003e2\u003c/sub\u003e, ...,B\u003csub\u003eN\u003c/sub\u003e, where B\u003csub\u003ei\u003c/sub\u003e represents what item Bob will play in the i\u003csup\u003eth\u003c/sup\u003e round. 1 represents Rock, 2 represents Paper, 3 represents Scissors.\u003cbr\u003eThe following M lines each contains three integers A,B,K(1 \u0026lt;\u003d A,B \u0026lt;\u003d N,K \u003d 0 or 1) represent a restrict for Alice. If K equals 0, Alice must play the same on A\u003csup\u003eth\u003c/sup\u003e and B\u003csup\u003eth\u003c/sup\u003e round. If K equals 1, she must play different items on Ath and Bthround."}},{"title":"Output","value":{"format":"HTML","content":"For each test case in the input, print one line: \"Case #X: Y\", where X is the test case number (starting with 1) and Y is \"yes\" or \"no\" represents whether Alice has a chance to win."}},{"title":"Sample","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\r\n3 3\r\n1 1 1\r\n1 2 1\r\n1 3 1\r\n2 3 1\r\n5 5\r\n1 2 3 2 1\r\n1 2 1\r\n1 3 1\r\n1 4 1\r\n1 5 1\r\n2 3 0\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: no\r\nCase #2: yes\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cbr\u003e\u0027Rock, Paper and Scissors\u0027 is a game which played by two person. They should play Rock, Paper or Scissors by their hands at the same time. \u003cbr\u003eRock defeats scissors, scissors defeats paper and paper defeats rock. If two people play the same item, the game is tied..\u003cbr\u003e"}}]}