operations, each operation can be expressed as a pair. . Print the final permutation in one line.numbers from the first number, erase the result number from the ring and write it into the back of the new permutation. numbers from the next number and do the same things again, until all numbers are written into
Roundgod is given a permutation P_{} P of length n_{} n (initially P = {1, 2, cdots, n} P={1,2,⋯,n}) and m_{} m operations, each operation can be expressed as a pair (k, x)_{} (k,x) , which means to do k-{} k−Josephus transform for x_{} x times on permutation P_{} P . Print the final permutation in one line. k-_{} k− Josephus transform is that: firstly list the n_{} n integers in premutation P_{} P in a ring, then count k_{} k numbers from the first number, erase the result number from the ring and write it into the back of the new permutation P'_{} P ′ , then count k_{} k numbers from the next number and do the same things again, until all numbers are written into P'_{} P ′ , which is the result permutation after doing k-{} k−Josephus transform for once on P_{} P . For example, {1, 2, 3, 4, 5}_{} {1,2,3,4,5} will become {3, 1, 5, 2, 4}_{} {3,1,5,2,4} if we do 3-_{} 3− Josephus transform for once on it.