#agc031d. [agc031_d]A Sequence of Permutations

[agc031_d]A Sequence of Permutations

Problem Statement

For two permutations pp and qq of the integers from 11 through NN, let f(p,q)f(p,q) be the permutation that satisfies the following:

  • The pip_i-th element (1leqileqN1 \\leq i \\leq N) in f(p,q)f(p,q) is qiq_i. Here, pip_i and qiq_i respectively denote the ii-th element in pp and qq.

You are given two permutations pp and qq of the integers from 11 through NN. We will now define a sequence {ana_n} of permutations of the integers from 11 through NN, as follows:

  • a1=pa_1=p, a2=qa_2=q
  • an+2=f(an,an+1)a_{n+2}=f(a_n,a_{n+1}) ( ngeq1n \\geq 1 )

Given a positive integer KK, find aKa_K.

Constraints

  • 1leqNleq1051 \\leq N \\leq 10^5
  • 1leqKleq1091 \\leq K \\leq 10^9
  • pp and qq are permutations of the integers from 11 through NN.

Input

Input is given from Standard Input in the following format:

NN KK p1p_1 ...... pNp_N q1q_1 ...... qNq_N

Output

Print NN integers, with spaces in between. The ii-th integer (1leqileqN1 \\leq i \\leq N) should be the ii-th element in aKa_K.


Sample Input 1

3 3
1 2 3
3 2 1

Sample Output 1

3 2 1

Since a3=f(p,q)a_3=f(p,q), we just need to find f(p,q)f(p,q). We have pi=ip_i=i here, so f(p,q)=qf(p,q)=q.


Sample Input 2

5 5
4 5 1 2 3
3 2 1 5 4

Sample Output 2

4 3 2 1 5

Sample Input 3

10 1000000000
7 10 6 5 4 2 9 1 3 8
4 1 9 2 3 7 8 10 6 5

Sample Output 3

7 9 4 8 2 5 1 6 10 3