A. Mash
time limit per test
1 second
memory limit per test
512 megabytes
input
standard input
output
standard output

Nikuniku designs a new programming language with only two kinds of instructions. Initially, we can consider the program as a queue $$$P$$$ containing of $$$n$$$ instructions. The program will need another queue of $$$Q$$$ to run. Initially, you copy all instructions from $$$P$$$ and add them to the back of the queue $$$Q$$$ in order. Afterward, each time $$$Q$$$ will pop the instruction in the front and run it. Now we give the format and usage of the two instructions:

  • echo c: Output a lower-case character $$$c$$$;
  • cp m: Copy the first $$$m$$$ instructions from $$$P$$$ and add them to the back of the queue $$$Q$$$ in order. It is guaranteed $$$1 \le m \le n$$$ here.

Now you need to simulate the process after running $$$k$$$ instructions from the queue. Specifically, please compute the string outputted by the program.

Input

The first line has two integers, $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^5$$$).

For the following $$$n$$$ lines, each line contains an instruction in the format of $$$s$$$ and $$$t$$$ separated by one space. $$$s$$$ will be either "echo" or "cp". If $$$s$$$ is "echo", $$$t$$$ will be a single lower-case character. Otherwise, $$$t$$$ will be an integer between $$$1$$$ and $$$n$$$.

Output

Output the result string in one line for the first $$$k$$$ instructions. If the program terminates with less than $$$k$$$ instructions run, output the result for all instructions.

Examples
Input
2 20
echo a
cp 2
Output
aaaaaaaaaa
Input
3 18
echo a
cp 2
echo b
Output
abaaaaaaaa
Input
4 40
echo a
cp 2
echo b
cp 4
Output
abaabaaabaaaabaaaaab
Input
5 50
echo a
cp 2
echo b
cp 5
cp 5
Output
abaababaaababaababaaaa