Skip to content

Latest commit

 

History

History
 
 

bfs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

BFS

Description

You are given an unweighted graph with N nodes and K edges. Let P and Q be two nodes in the graph. You are asked to find the shortest path between the two nodes.

Input

Each test contains multiple test cases. The first line contains a single integer T - the number of test cases. Description of the test cases follows.

The first line of the input contains two unsigned integers N and K - the number of nodes and edges respectedly.

Each of the next K lines contains two unsigned integers V and U - the description of an edge.

The last line contains two unsigned integers P and Q - the to and from nodes.

Output

Shell

First Solve: Inquisitioners of Go