Problem: There are planets. Each planet has a teleporter to exactly one other planet. Given queries , find the minimum teleportations to get from to , or report it's impossible.
Link: CSES 1160
Constraints:
Note: Each planet has exactly one outgoing teleporter. This is a functional graph.