{"problem":{"name":"Well-defined Path Queries on a Namori","description":{"content":"You are given a connected simple undirected graph $G$ with $N$ vertices numbered $1$ to $N$ and $N$ edges. The $i$\\-th edge connects Vertex $u_i$ and Vertex $v_i$ bidirectionally. Answer the following","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":3000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc266_f"},"statements":[{"statement_type":"Markdown","content":"You are given a connected simple undirected graph $G$ with $N$ vertices numbered $1$ to $N$ and $N$ edges. The $i$\\-th edge connects Vertex $u_i$ and Vertex $v_i$ bidirectionally.\nAnswer the following $Q$ queries.\n\n*   Determine whether there is a unique simple path from Vertex $x_i$ to Vertex $y_i$ (a simple path is a path without repetition of vertices).\n\n## Constraints\n\n*   $3 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq u_i < v_i\\leq N$\n*   $(u_i,v_i) \\neq (u_j,v_j)$ if $i \\neq j$.\n*   $G$ is a connected simple undirected graph with $N$ vertices and $N$ edges.\n*   $1 \\leq Q \\leq 2 \\times 10^5$\n*   $1 \\leq x_i < y_i\\leq N$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$u_1$ $v_1$\n$u_2$ $v_2$\n$\\vdots$\n$u_N$ $v_N$\n$Q$\n$x_1$ $y_1$\n$x_2$ $y_2$\n$\\vdots$\n$x_Q$ $y_Q$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc266_f","tags":[],"sample_group":[["5\n1 2\n2 3\n1 3\n1 4\n2 5\n3\n1 2\n1 4\n1 5","No\nYes\nNo\n\nThe simple paths from Vertex $1$ to $2$ are $(1,2)$ and $(1,3,2)$, which are not unique, so the answer to the first query is `No`.\nThe simple path from Vertex $1$ to $4$ is $(1,4)$, which is unique, so the answer to the second query is `Yes`.\nThe simple paths from Vertex $1$ to $5$ are $(1,2,5)$ and $(1,3,2,5)$, which are not unique, so the answer to the third query is `No`."],["10\n3 5\n5 7\n4 8\n2 9\n1 2\n7 9\n1 6\n4 10\n2 5\n2 10\n10\n1 8\n6 9\n8 10\n6 8\n3 10\n3 9\n1 10\n5 8\n1 10\n7 8","Yes\nNo\nYes\nYes\nNo\nNo\nYes\nNo\nYes\nNo"]],"created_at":"2026-03-03 11:01:14"}}