#P5151. HKE与他的小朋友
HKE与他的小朋友
Description
There are seats numbered to , and the children are also numbered to . Initially, every child sits in the seat with the same number. The game of HKE can be described by an -permutation . In one round, for every , the child sitting at position moves to position .
After rounds, HKE wants to know which child ends up at positions .
Input Format
The first line contains two integers . The second line contains a permutation .
Output Format
Output one line with numbers denoting the child at positions .
5 5
2 3 1 5 4
2 3 1 5 4
5 4
2 3 1 5 4
3 1 2 4 5
Hint
- For of the testdata, , .
- For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号