7 8 1 3 3 4 4 5 1 5 4 6 2 6 2 7 4 7
Yes 5 6 4 1 5 6 1 4 4 2 4 2 Here, signposts are placed as shown in the figure below. For example, from vertex $3$: * Following the blue signpost, you move as vertex $3\rightarrow 4\rightarrow 5\rightarrow 1$, eventually reaching vertex $1$. * Following the yellow signpost, you move as vertex $3\rightarrow 1\rightarrow 5\rightarrow 4 \rightarrow 6\rightarrow 2$, eventually reaching vertex $2$. You can also verify that following the blue signpost from vertex $2$ leads to vertex $1$, and following the yellow signpost from vertex $1$ leads to vertex $2$. The other vertices also satisfy the conditions.  There are multiple other solutions, but you must not have both the blue signpost and the yellow signpost at vertex $3$ point to vertex $4$, because the signposts at the same vertex would point to the same vertex.
10 12 1 3 3 4 4 5 1 5 4 6 2 6 2 7 4 7 4 8 8 9 9 10 8 10
No There is no way to place signposts satisfying the conditions.
{
"problem": {
"name": "Michishirube",
"description": {
"content": "You are given a simple connected undirected graph with $N$ vertices and $M$ edges. The $i$\\-th edge $(1\\leq i\\leq M)$ is an undirected edge connecting vertices $U_i$ and $V_i$. Place signposts at all ",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc211_d"
},
"statements": [
{
"statement_type": "Markdown",
"content": "You are given a simple connected undirected graph with $N$ vertices and $M$ edges. The $i$\\-th edge $(1\\leq i\\leq M)$ is an undirected edge connecting vertices $U_i$ and $V_i$.\nPlace signposts at all ...",
"is_translate": false,
"language": "English"
}
]
}