Under construction

Still being built. Things may change

Pineapple Advertising

Interview

Time limit1sMemory limit256 MB

Summary
After each of Q pizza deliveries to a house, report how many houses (the house itself plus its direct neighbors) like pineapple pizza for the first time.
Level

Medium4 of 10

Topics
Graph, Hash map, Implementation, Simulation
Solved
No attempts yet

Problem

Byeongchan likes pineapples very much, and pineapple pizza in particular. To spread the word about how wonderful pineapple pizza is, he wants to advertise pineapple pizza in a village.

The village has N houses in total, and all N of them dislike pineapple pizza. The village also has M roads, and each road connects two particular houses. Depending on how the roads are laid out, some house may not be connected to any road. Byeongchan can deliver a pineapple pizza to a particular house. Then the smell of the delicious pineapple pizza makes the house that received the pizza and the houses directly connected to it by a road start to like pineapple pizza.

Byeongchan wants to deliver pineapple pizza to Q of the houses in this village. He may of course deliver pizza again to a house that already received one. Each time he delivers a pizza, from the first house to the Q-th house, he wants to know how many houses newly started to like pineapple pizza. Help Byeongchan find how many houses newly started to like pineapple pizza.

Input

The first line gives N, M, and Q. (1 ≤ N ≤ 200,000, 0 ≤ M ≤ 1,000,000)

Lines 2 through M + 1 give ai and bi. (1 ≤ ai, bi ≤ N) This means house ai and house bi are connected by a road.

After that, Q lines (1 ≤ Q ≤ 200,000) give the number ni of the house that will receive a pizza.

Output

Print Q integers. The i-th integer is the number of houses that newly started to like pineapple pizza when Byeongchan gives a pineapple pizza to house ni.

A house that already likes pineapple pizza is not counted as newly starting to like it.

Hint

The village in the sample looks like this.

If Byeongchan delivers a pineapple pizza to house 1 here, houses 1, 2, and 3 newly start to like pineapple pizza as shown below.

If he then delivers a pineapple pizza to house 2, house 4 newly starts to like pineapple pizza.

Houses 1, 2, and 3 already like pineapple pizza, so they are not included in the output count.

Examples1

  1. Example 1

    Input
    4 5 2
    1 2
    1 3
    2 3
    3 4
    2 4
    1
    2
    
    Expected output
    3
    1