AT_past18_d 大乱闘

Description

$ N $ players numbered $ 1 $ through $ N $ are playing a multiplayer fighting game. When a match starts, the $ N $ players **enter** a ring at once. Initially, each player's **score** is $ 0 $ . Then, $ M $ events occur during the match. Each event is of type $ 1 $ or type $ 2 $ described below: - Type $ 1 $ : represented in the following format. Player $ x $ **attacks** player $ y $ . > 1 $ x $ $ y $ - Type $ 2 $ : represented in the following format. Player $ z $ **drops out** of the ring. > 2 $ z $ When a player drops out of the ring, the following events immediately occur: - The score of the player who has dropped out decreases by $ 1 $ . - If the player who has dropped out was attacked at least once since the last entrance, the score of the player who made the last such attack increases by $ 1 $ . - Then, the player enters the ring again. Print the final score of each player.

Input Format

The input is given from Standard Input in the following format: > $ N $ $ M $ $ \mathrm{event}_1 $ $ \mathrm{event}_2 $ $ \vdots $ $ \mathrm{event}_M $ For $ i = 1, 2, \ldots, M $ , $ \mathrm{event}_i $ represents the $ i $ -th event, and is in type- $ 1 $ or type- $ 2 $ format described in the problem statement.

Output Format

For $ i = 1, 2, \ldots, N $ , print the final score $ S_i $ of player $ i $ in the following format, separated by spaces: > $ S_1 $ $ S_2 $ $ \ldots $ $ S_N $

Explanation/Hint

### Sample Explanation 1 When the match starts, $ 4 $ players enter the ring, and the players' scores are $ (S_1, S_2, S_3, S_4) = (0, 0, 0, 0) $ . Then, the following events occur during the match: - In the $ 1 $ -st event, player $ 2 $ attacks player $ 3 $ . - In the $ 2 $ -nd event, player $ 4 $ attacks player $ 3 $ . - In the $ 3 $ -rd event, player $ 3 $ drops out, so their score decreases by $ 1 $ . Since player $ 3 $ 's last entrance (i.e. since the match begins), they are attacked in the $ 1 $ -st and $ 2 $ -nd event. The last one among them is made by player $ 4 $ , so their score increases by $ 1 $ . Subsequently, player $ 3 $ enters the ring again. - In the $ 4 $ -th event, player $ 2 $ attacks player $ 1 $ . - In the $ 5 $ -th event, player $ 2 $ drops out, so their score decreases by $ 1 $ . Since player $ 2 $ 's last entrance (i.e. since the match begins), they are never attacked. Subsequently, player $ 2 $ enters the ring again. - In the $ 6 $ -th event, player $ 3 $ drops out, so their score decreases by $ 1 $ . Since player $ 3 $ 's last entrance (i.e. since the $ 3 $ -rd event), they are never attacked. Subsequently, player $ 3 $ enters the ring again. The final scores of the players are $ (S_1, S_2, S_3, S_4) = (0, -1, -2, 1) $ . ### Constraints - All input values are integers. - $ 2 \leq N \leq 2 \times 10^5 $ - $ 1 \leq M \leq 2 \times 10^5 $ - $ 1 \leq x, y, z \leq N $ - $ x \neq y $