4 1 2 4 2 3 1
1 2 4 2 1 3 1 His journey will be as follows. * Start in City $1$. * The unvisited cities directly connected to City $1$ are City $2$ and $3$. Go to the city with the smaller number, that is, City $2$. * The unvisited city directly connected to City $2$ is City $4$. Go there. * There is no unvisited city directly connected to City $4$. Go back to City $2$. * There is no unvisited city directly connected to City $2$. Go to City $1$, where he was in just before visiting City $2$ for the first time. * The unvisited city directly connected to City $1$ is City $3$. Go there. * There is no unvisited city directly connected to City $3$. Go back to City $1$. * There is no unvisited city directly connected to City $1$. End the journey.
5 1 2 1 3 1 4 1 5
1 2 1 3 1 4 1 5 1
{
"problem": {
"name": "Takahashi Tour",
"description": {
"content": "The Republic of AtCoder has $N$ cities numbered $1$ through $N$ and $N-1$ roads numbered $1$ through $N-1$. Road $i$ connects City $A_i$ and City $B_i$ bidirectionally. It is guaranteed that one can t",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc213_d"
},
"statements": [
{
"statement_type": "Markdown",
"content": "The Republic of AtCoder has $N$ cities numbered $1$ through $N$ and $N-1$ roads numbered $1$ through $N-1$. Road $i$ connects City $A_i$ and City $B_i$ bidirectionally. It is guaranteed that one can t...",
"is_translate": false,
"language": "English"
}
]
}