CSES - NOI 2024 - Anime Shops
  • Time limit: 1.00 s
  • Memory limit: 512 MB

There are nn cities and mm roads. Each road is bidirectional and connects two cities. It is also known that kk cities have an anime shop.

If you live in a city, you of course know the local anime shop well if there is one. You would like to find the nearest anime shop that is not in your city.

For each city, determine the minimum distance to another city that has an anime shop.

Input

The first line has three integers nn, mm and kk: the number of cities, roads and anime shops. The cities are numbered 1,2,,n1,2,\dots,n.

The next line contains kk integers: the cities that have an anime shop.

Finally, there are mm lines that describe the roads. Each line has two integers aa and bb: there is a road between cities aa and bb.

Output

Print nn integers: for each city, the minimum distance to another city with an anime shop. If there is no such city, print 1-1 instead.

Example

Input:

9 6 4
2 4 5 7
1 2
1 3
1 8
2 4
3 4
5 6

Output:

1 1 1 1 -1 1 -1 2 -1

Subtask 1 (23 points)

  • 1kn10001 \le k \le n \le 1000
  • 0m20000 \le m \le 2000

Subtask 2 (16 points)

  • 1kn1051 \le k \le n \le 10^5
  • m=n1m=n-1
  • Each road is between cities ii and i+1i+1 for i=1,2,,n1i=1,2,\dots,n-1

Subtask 3 (61 points)

  • 1kn1051 \le k \le n \le 10^5
  • 0m21050 \le m \le 2 \cdot 10^5