Kuo-chan is given a sequence A and a constant K as his birthday present from Yang-chan.
Kuo-chan is allowed to perfrom the following operation:
Whenever performing pop operation, the length of A is guaranteed to be odd, hence A won't be empty.
For example, if A = [4, 3, 5], K = 2
push 11 ► A = [4, 3, 5, 11]
reverse ► A = [11, 5, 3, 4]
push 7 ► A = [11, 5, 3, 4, 7]
pop ► A = [11, 5, 4, 7]
programming tanoshi ► A = [1, 1, 0, 1]
Yang-chan is curious about what A is after Kuo-chan performs some operations to it.
Help him find it out!
(Remember to include function.h in your function.cpp file.)
The first line contains three integers N K Q — the length of A, the constant Yang-chan gives Kuo-chan, the number of operations Kuo-chan performs.
The second line contains N integers a1, a2, ..., aN (1 <= ai <= N) — the elements of A.
Each of the next Q lines describes the operations. Each line is one of three types:
Different testcases have different constraints.
You should print one line containing the elements of A after the operations. For 1 <= i <= |A|, the i-th number should be A[ i ].