Or Machine

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

문제

We are developing the Or Machine, a computer heavily optimized solely for one kind of operation: the \verb |= \ operator in C++'s term.

The Or Machine has nn registers, each containing a nonnegative integer less than 282^8. We label them x_1,x_2,,x_nx\_1, x\_2, \cdots, x\_n. A program is represented by a list of ll operations. Each operation is represented by a pair of integers (a,b)(a, b), meaning that the machine should update x_ax\_a with the bitwise OR of x_ax\_a's and x_bx\_b's values.

The Or Machine takes a program, the initial values of the registers, and a positive integer tt. When run, the program performs each operation in the program one by one. When the last operation is performed, it goes back to the first operation and repeats the process. The machine stops after performing exactly tt operations.

We want our machine to be much faster than general-purpose computers, and hardware optimization is probably not enough. Can you help us with some software optimization?

입력

The first line contains three integers, nn, ll, and t (1n,l218t\ (1 \leq n, l \leq 2^{18}, 1t1018)1 \leq t \leq 10^{18}). ll is the length of the program.

The program is given on the next ll lines. Each line contains two integers aa and b (1a,bn)b\ (1 \leq a, b \leq n) representing the pair of registers that participate in the given operation.

The final line contains nn integers, the initial values of the registers x_1,,x_n (0x_i<28)x\_1, \cdots, x\_n\ (0 \le x\_i < 2^8).

출력

Output nn integers on a single line, the values of the registers x_1,,x_nx\_1, \cdots, x\_n after tt operations.