Sunyeong built a small language called AC for manipulating integer arrays. The language has exactly two functions, R and D.
Functions can be chained and applied together. For example, RDD reverses the array once and then discards the first two numbers.
Given the initial array and a string of functions to run, write a program that outputs the final array after all functions have been applied.
The first line contains the number of test cases $T$. ($T \le 100$)
Each test case consists of three lines:
[x1,x2,...,xn]. ($1 \le x_i \le 100$) An empty array is given as [].Over all test cases, the sum of the lengths of $p$ and the sum of $n$ each do not exceed 700,000.
For each test case, print the resulting array after applying every function, in the form [x1,x2,...,xn] on a single line, with elements separated by commas and no spaces. If an error occurs because D is applied to an empty array at any point, print error instead.