Congratulation! You helped ItakEjgo solved two problems!
Before attack Huang Bo again, the army master created a special group. The combat value of soldiers in the special group list are random. The army master has four basic instructions in the special group: 1) Insert (x, y), 2) Delete(x), 3) Update(x,y), and 4) Reverse. The means of these instructions are:
Insert(x,y): insert soldier with combat value y at position x.
Delete(x): remove soldier at position x
Update(x,y): set combat value of soldier at position x as y.
Reverse: reverse the soldiers’ combat value in the special group list.
For example, suppose we have special group list {1,3,2,4}, position is starting from 0.
Insert (0,5) will change the special group list to {5,1,3,2,4}
Delete(3) will change the special group list to {5,1,3,4}
Update(1,7) will change the special group list to {5,7,3,4}
Reverse will change the special group list to {4,3,7,5}
Given a special group list, and a set of instructions, could you print the special group list to ItakEjgo after each instruction? For simplicity, Insert is 1, Delete is 2, Update is 3 and Reverse is 4 in the input.