Bill is an excellent programmer (not coder, of course) of one of the best software companies in the world. Recently, he is working on some projects which frequently read and write files. Considering space efficiency and universality, he decides to manipulate these files in binary format.

Here are the format definitions:

  1. Files are NOT self-described, i.e., we can't know the data structure of one file without any documentation.
  2. A file is composed of several 'items'. Items are stored in files one after another. There's nothing else, but only items.
  3. An 'item' is one of following data types:
Type Descriptor Bytes needed in files
32-bit unsigned integer UINT 4
32-bit signed integer INT 4
16-bit unsigned integer USHORT 2
16-bit signed integer SHORT 2
8-bit byte (unsigned) BYTE 1
String STR 2 + length of the string

One more thing about item is that strings are stored in files as the format [L][S]. L is the length of string, it's a USHORT item. And S is the string itself, it's a sequence of L characters.

Based on the definitions above, a function named Read is defined as: 'Read(dataType);'. Data read from files is directly output to screen.

Similarly, there's another function: 'Skip(dataType);' which moves the file pointer forward by the bytes of the data type.

Now let's come to the problem, given a file and several invocations of Read function or Skip function with certain parameters, output proper result on the following rules:

  1. The file pointer initially points to the first byte of the file. It's automatically moved after each successful reading operation or successful skipping operation. File pointer doesn't change when operation is unsuccessful.
  2. Reading is unsuccessful when there's not enough data remains or data in current position is invalid for the current data type.
  3. Skipping is unsuccessful when there's not enough space to skip or data in current position is invalid for the current data type.
  4. Valid string should not contain more than 100 characters and contains only letters and spaces.
  5. Data read is directly output to screen, one on a separated line.


Input contains several test cases, each test case is as following:

<file data>

N is the number of lines in file data. M is the number of operations. 0 < N, M < 100. If N and M are both zero, input ends.

File data is represented by hex numbers, each indicates one byte of file, from the first to the last. Hex numbers are separated by only one space, there're 100 hex numbers in a line at most. Each hex number is always 2-digit long and contains only numbers and uppercase characters (if necessary).

Each operations has the format '<R|S><SP>dataType', R is for Read, S is for Skip, dataType is based on the table above. SP indicates only one space.


For successful reading operation, output the data read, in decimal if data is not a string, one per line. For other operations, don't output anything.

After each test case, please output a blank line.

Sample Input

1 3
01 0A 02 00 00 0C 01 
2 1
0B 00 41 42 43 44 45 46 47 48 49
4A 4B
0 0

Sample Output