{"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\"\u003eGiven an undirected graph G\u003d(V,E). All vertices are numbered from 1 to N. And every vertex u has a value of $A_u$. Let $S_u$\u003d{$A_v$│(u,v)∈E}. Also, F(u) equals MEX(minimum excludant) value of $S_u$. A MEX value of a set is the smallest non-negative integer which doesn’t exist in the set.\u003cbr\u003e\u003cbr\u003eThere are two types of queries.\u003cbr\u003e\u003cbr\u003eType 1: 1 u x – Change $A_u$ to x (0≤x≤$10^9$).\u003cbr\u003eType 2: 2 u – Calculate the value of F(u).\u003cbr\u003e\u003cbr\u003eFor each query of type 2, you should answer the query.\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of input contains a single integer T (1≤T≤10) denoting the number of test cases. Each test case begins with a single line containing two integers n (1≤n≤$10^5$), m (1≤m≤$10^5$) denoting the number of vertices and number of edges in the given graph.\u003cbr\u003e\u003cbr\u003eThe next line contains n integers and $i^{th}$ of them is a value of $A_i$ (0≤$A_i$≤$10^9$).\u003cbr\u003e\u003cbr\u003eThe next m lines contain edges of the graph. Every line contains two integers u, v meaning there exist an edge between vertex u and v.\u003cbr\u003e\u003cbr\u003eThe next line contains a single integer q (1≤q≤$10^5$) denoting the number of queries.\u003cbr\u003e\u003cbr\u003eThe next q lines contain queries described in the description.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each query of type 2, output the value of F(u) in a single line."}},{"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\u003e1\r\n5 4\r\n0 1 2 0 1\r\n1 2\r\n1 3\r\n2 4\r\n2 5\r\n5\r\n2 2\r\n1 2 2\r\n2 2\r\n1 3 1\r\n2 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n2\r\n0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}