The directed graph is given. Find the shortest distance from the vertex to other vertices of the graph.
The first line contains two integers and — the number of vertices in a graph and the starting vertex. Each of the next lines contains numbers — the adjacency matrix of the graph: the -th line and -th column contains "", if the vertices and are connected with the edge, and "", if there is no edge between them. The main diagonal contains zeroes.
Print the numbers , where is if there is no path from to , or the minimal distance from to otherwise.