In the first line,there is an integer Q,which means the number of operations to perform.
In the next Q lines,the i-th line describes the i-th operation containing some integers.Such a line may look like this:
1 Si c
2 0 Ti c =>add c to the beginning of Ti
2 1 Ti c =>add c to the end of Ti
3 Ti Tj
4 Ti Si
The number of the first operation will not exceed 100000.
The number of the third operation will not exceed 30000.
The number of fourth operation will not exceed 100000.