Evacuation
One of the top-secret organizations, whose name we cannot reveal, operates a network of N underground bunkers. These bunkers are interconnected by tunnels of equal length, allowing travel between any two bunkers, though not necessarily directly. Some bunkers have special secret exits that connect to the outside world.
The organization needs to devise an evacuation plan for emergencies. To do this, it's crucial to determine the time required for each bunker to reach the nearest exit. As a specialist in such tasks, you are tasked with calculating this time for each bunker based on the provided description of the organization's facilities. For convenience, the bunkers are numbered from 1 to N.
Input
The input begins with two natural numbers N and K (1 ≤ N ≤ 100000, 1 ≤ K ≤ N) — representing the number of bunkers and the number of exits, respectively.
Following this, K distinct numbers from 1 to N are provided, indicating the bunkers where the exits are located.
Next, the number M (1 ≤ M ≤ 100000) is given, representing the number of tunnels. This is followed by M pairs of numbers, each pair indicating the bunkers connected by a tunnel. Each tunnel can be traversed in both directions. There are no tunnels that connect a bunker to itself, but there may be multiple tunnels between the same pair of bunkers.
Output
Output N numbers separated by spaces — each number representing the minimum time required for each bunker to reach an exit. Assume that traversing one tunnel takes 1 unit of time.