Dance Mooves

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Farmer John’s cows are showing off their new dance mooves!

At first, all NN cows (2N1052\le N\le 10^5) stand in a line with cow ii in the iith position in line. The sequence of dance mooves is given by KK (1K21051\le K\le 2\cdot 10^5) pairs of positions (a_1,b_1),(a_2,b_2),,(a_K,b_K)(a\_1,b\_1), (a\_2,b\_2), \ldots, (a\_{K},b\_{K}). In each minute i=1Ki = 1 \ldots K of the dance, the cows in positions a_ia\_i and b_ib\_i in line swap. The same KK swaps happen again in minutes K+12KK+1 \ldots 2K, again in minutes 2K+13K2K+1 \ldots 3K, and so on, continuing in a cyclic fashion for a total of MM minutes (1M10181\le M\le 10^{18}). In other words,

  • In minute 11, the cows at positions a_1a\_1 and b_1b\_1 swap.
  • In minute 22, the cows at positions a_2a\_2 and b_2b\_2 swap.
  • ...
  • In minute KK, the cows in positions a_Ka\_{K} and b_Kb\_{K} swap.
  • In minute K+1K+1, the cows in positions a_1a\_{1} and b_1b\_{1} swap.
  • In minute K+2K+2, the cows in positions a_2a\_{2} and b_2b\_{2} swap.
  • and so on ...

For each cow, please determine the number of unique positions in the line she will ever occupy.

입력

The first line contains integers NN, KK, and MM. Each of the next KK lines contains (a_1,b_1)(a_K,b_K)(a\_1,b\_1) \ldots (a\_K, b\_K) (1a_i\<b_iN1\le a\_i\<b\_i\le N).

출력

Print NN lines of output, where the iith line contains the number of unique positions that cow ii reaches.