{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eSnuke\u0027s mother gave Snuke an undirected graph consisting of \u003cvar\u003e\\(N\\)\u003c/var\u003e vertices numbered \u003cvar\u003e\\(0\\)\u003c/var\u003e to \u003cvar\u003e\\(N-1\\)\u003c/var\u003e and \u003cvar\u003e\\(M\\)\u003c/var\u003e edges.\r\nThis graph was connected and contained no parallel edges or self-loops.\u003c/p\u003e\r\n\u003cp\u003eOne day, Snuke broke this graph.\r\nFortunately, he remembered \u003cvar\u003e\\(Q\\)\u003c/var\u003e clues about the graph.\r\nThe \u003cvar\u003e\\(i\\)\u003c/var\u003e-th clue (\u003cvar\u003e\\(0 \\leq i \\leq Q-1\\)\u003c/var\u003e) is represented as integers \u003cvar\u003e\\(A_i,B_i,C_i\\)\u003c/var\u003e and means the following:\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eIf \u003cvar\u003e\\(C_i\u003d0\\)\u003c/var\u003e: there was exactly one simple path (a path that never visits the same vertex twice) from Vertex \u003cvar\u003e\\(A_i\\)\u003c/var\u003e to \u003cvar\u003e\\(B_i\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eIf \u003cvar\u003e\\(C_i\u003d1\\)\u003c/var\u003e: there were two or more simple paths from Vertex \u003cvar\u003e\\(A_i\\)\u003c/var\u003e to \u003cvar\u003e\\(B_i\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eSnuke is not sure if his memory is correct, and worried whether there is a graph that matches these \u003cvar\u003e\\(Q\\)\u003c/var\u003e clues.\r\nDetermine if there exists a graph that matches Snuke\u0027s memory.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(2 \\leq N \\leq 10^5\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(N-1 \\leq M \\leq N \\times (N-1)/2\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq Q \\leq 10^5\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(0 \\leq A_i,B_i \\leq N-1\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(A_i \\neq B_i\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(0 \\leq C_i \\leq 1\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003eAll values in input are integers.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e \u003cvar\u003e\\(M\\)\u003c/var\u003e \u003cvar\u003e\\(Q\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(A_0\\)\u003c/var\u003e \u003cvar\u003e\\(B_0\\)\u003c/var\u003e \u003cvar\u003e\\(C_0\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(A_1\\)\u003c/var\u003e \u003cvar\u003e\\(B_1\\)\u003c/var\u003e \u003cvar\u003e\\(C_1\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(\\vdots\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(A_{Q-1}\\)\u003c/var\u003e \u003cvar\u003e\\(B_{Q-1}\\)\u003c/var\u003e \u003cvar\u003e\\(C_{Q-1}\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eIf there exists a graph that matches Snuke\u0027s memory, print \u003ccode\u003eYes\u003c/code\u003e; otherwise, print \u003ccode\u003eNo\u003c/code\u003e.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 1","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\u003e5 5 3\r\n0 1 0\r\n1 2 1\r\n2 3 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYes\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eFor example, consider a graph with edges \u003cvar\u003e\\((0,1),(1,2),(1,4),(2,3),(2,4)\\)\u003c/var\u003e. This graph matches the clues.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 2","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\u003e4 4 3\r\n0 1 0\r\n1 2 1\r\n2 3 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eNo\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 3","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\u003e10 9 9\r\n7 6 0\r\n4 5 1\r\n9 7 0\r\n2 9 0\r\n2 3 0\r\n4 1 0\r\n8 0 0\r\n9 1 0\r\n3 0 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eNo\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\u003c/section\u003e\r\n"}}]}