Evacuation#581

Evacuation

1 second
64 megabytes
Easy

One of the secret organizations, whose name cannot be disclosed, operates a network of underground bunkers. These bunkers are interconnected by tunnels of equal length, such that from any bunker, it is possible to reach any other bunker (not necessarily directly). Connections with the outside world are made through special secret exits located in some of the bunkers.

Input

The first line contains two natural numbers , (1 \leq N \leq 100000, 1 \leq K \leq N) — the number of bunkers and the number of exits, respectively.

The next line contains distinct integers from to , indicating the bunkers with exits.

The next line contains the integer (1 \leq M \leq 100000) — the number of tunnels. Then pairs of integers follow, each pair describing a tunnel and indicating the bunkers it connects. Each tunnel can be traversed in both directions. There are no tunnels connecting a bunker to itself, but there may be multiple tunnels between the same pair of bunkers.

Output

Output integers separated by spaces — for each bunker, the minimal time required to reach an exit. Assume that it takes unit of time to traverse one tunnel.

Examples

Example 1

Loading
Loading