CF59E Shortest Path
Description
In Ancient Berland there were $ n $ cities and $ m $ two-way roads of equal length. The cities are numbered with integers from $ 1 $ to $ n $ inclusively. According to an ancient superstition, if a traveller visits three cities $ a_{i} $ , $ b_{i} $ , $ c_{i} $ in row, without visiting other cities between them, a great disaster awaits him. Overall there are $ k $ such city triplets. Each triplet is ordered, which means that, for example, you are allowed to visit the cities in the following order: $ a_{i} $ , $ c_{i} $ , $ b_{i} $ . Vasya wants to get from the city $ 1 $ to the city $ n $ and not fulfil the superstition. Find out which minimal number of roads he should take. Also you are required to find one of his possible path routes.
Input Format
The first line contains three integers $ n $ , $ m $ , $ k $ ( $ 2
Output Format
If there are no path from $ 1 $ to $ n $ print -1. Otherwise on the first line print the number of roads $ d $ along the shortest path from the city $ 1 $ to the city $ n $ . On the second line print $ d+1 $ numbers — any of the possible shortest paths for Vasya. The path should start in the city $ 1 $ and end in the city $ n $ .