3 2 0 2 1 2
\-1 -1 2 When the Teleporters with an undetermined end are all determined to be connected to Town $1$, the $1$\-st and the $2$\-nd Teleporters both connect Towns $1$ and $2$. Then, it is impossible to travel from Town $1$ to Town $3$. When the Teleporters with an undetermined end are all determined to be connected to Town $2$, the $1$\-st Teleporter connects Town $2$ and itself, and the $2$\-nd one connects Towns $1$ and $2$. Again, it is impossible to travel from Town $1$ to Town $3$. When the Teleporters with an undetermined end are all determined to be connected to Town $3$, the $1$\-st Teleporter connects Town $3$ and Town $2$, and the $2$\-nd one connects Towns $1$ and $2$. In this case, we can travel from Town $1$ to Town $3$ in two minutes. * Use the $2$\-nd Teleporter to travel from Town $1$ to Town $2$. * Use the $1$\-st Teleporter to travel from Town $2$ to Town $3$. Therefore, $-1,-1$, and $2$ should be printed in this order. Note that, depending on which town the Teleporters with an undetermined end are connected to, there may be a Teleporter that connects a town and itself, or multiple Teleporters that connect the same pair of towns.
5 5 1 2 1 3 3 4 4 5 0 2
3 3 3 3 2
{
"problem": {
"name": "Teleporter Setting",
"description": {
"content": "There are $N$ towns numbered Town $1$, Town $2$, $\\ldots$, Town $N$. There are also $M$ _Teleporters_, each of which connects two towns bidirectionally so that a person can travel from one to the ot",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc257_f"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There are $N$ towns numbered Town $1$, Town $2$, $\\ldots$, Town $N$. \nThere are also $M$ _Teleporters_, each of which connects two towns bidirectionally so that a person can travel from one to the ot...",
"is_translate": false,
"language": "English"
}
]
}