시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB53332959.184%

문제

It is well known that all horse races in Birmingham are fixed days in advance. It is a little less known that people who fix these races (and thereby know the winner) do that on a secret meeting and start spreading the information around the city the day after that meeting.

The first day after the meeting, all people that know the information about the winner start sharing that information with all people that live at most K steps away from their house.

The second day after the meeting, all people that know the information about the winner start sharing that information with all people that live at most 2 · K steps away from their house.

In general, X-th day after the meeting, all people that know the information about the winner start sharing that information with all people that live at most X · K steps away from their house.

We can represent Birmingham as a graph where vertices represent the houses and edges represent bidirectional roads which connect these houses. Houses are indexed with increasing integers from 1 to N and we say that a person can travel each road in a single step. It is possible to reach each house from each other house by traversing a sequence of roads.

Your task is to determine, for each house, on which day will the information about the race winner reach it.

입력

The first line contains four integers N, M, Q and K (1 ≤ N, Q, K ≤ 100 000, Q ≤ N, 1 ≤ M ≤ 200 000), the number of houses in Birmingham, the number of roads in Birmingham, the number of people that were present on the secret meeting and the number K from task description.

The next line contains Q integers where the i-th integer represents the index of a house where the i-th person from the secret meeting lives in.

The i-th of the next M lines contains integers Ai and Bi (1 ≤ Ai, Bi ≤ N, Ai ≠ Bi), which denote that the i-th road connects houses with indices Ai and Bi.

출력

Output N numbers where the i-th number represents on which day after the meeting will the person living in house with index i find out who will win the race. If the person living in that house was present on the secret meeting, output 0 instead.

예제 입력 1

6 8 1 1
6
1 3
1 5
1 6
2 5
2 6
3 4
3 5
5 6

예제 출력 1

1 1 2 2 1 0

예제 입력 2

6 8 2 1
6 4
1 3
1 5
1 6
2 5
2 6
3 4
3 5
5 6

예제 출력 2

1 1 1 0 1 0

예제 입력 3

6 8 1 2
6
1 3
1 5
1 6
2 5
2 6
3 4
3 5
5 6

예제 출력 3

1 1 1 2 1 0

The figure represents a graph from the third example. Since houses 1, 2, 3 and 5 are at most two steps away from house 6, people living in them will find out about the winner the day after the meeting. Person living in house 4 will find out about the winner two days after the meeting.