acmsguru |
---|
Finished |
LENGTH" query output the answer on the separate line, or -1 if there's no way to travel from one city to another.
sample input | sample output |
3 3 1 2 2 3 3 1 LENGTH 1 2 DELETE 1 LENGTH 1 2 LENGTH 2 3 DELETE 3 LENGTH 1 2 | 1 2 1 -1 |
Name |
---|