4 4 1 2 2 3 3 4 4 2 0 1 0 1
Yes For example, consider starting from vertex $1$. In the first operation, move to vertex $2$ and change the color of the vertex $1$ from white to black. This change in the graph is shown in the figure below (the vertex circled is the current vertex). Then, if you move to vertices $3$, $4$, and $2$ in order, the colors of vertices $1,2,3,4$ will then be black, white, black, and white, respectively. Therefore, you can move to vertex $1$ in the next operation, returning to the starting point. 
5 6 1 2 2 3 3 4 4 5 1 4 2 5 0 1 0 1 0
No In this graph, no matter which vertex you choose as the starting point, you cannot return to the starting point by making moves that satisfy the conditions.
{
"problem": {
"name": "Switching Travel",
"description": {
"content": "There is a simple connected undirected graph with $N$ vertices numbered from $1$ to $N$. This graph has $M$ edges, and the $i$\\-th edge connects two vertices $a_i$ and $b_i$. Each vertex has a color, ",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "arc164_b"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There is a simple connected undirected graph with $N$ vertices numbered from $1$ to $N$. This graph has $M$ edges, and the $i$\\-th edge connects two vertices $a_i$ and $b_i$.\nEach vertex has a color, ...",
"is_translate": false,
"language": "English"
}
]
}