In this problem, you are to implement a command line text editor. This text editor has n edit areas labeled from 1 to n sequentially and a clipboard with size m. The following commands are available for the text editor:
Initially, all the edit areas are empty, the cursor is in the first edit area. You are given several commands and after all the commands, output all the characters in current edit area.
There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:
The first line contains three integers n, q and m (1 ≤ n ≤ 10, 1 ≤ m, q ≤ 1000) − the number of edit areas, the sizeof the clipboard and the number commands.
The next q lines, each contains a command, the format is described above.
3
1 6 2
print a
print b
copy
paste
delete
paste
1 2 2
print a
delete
2 10 3
print a
print c
copy
paste
next
paste
paste
delete
copy
paste
abaab
Empty
acaaca