Pasha is a strange guy. He has a string of length N. He wants to perform 2 types of queries on the string.
Type 1- Rotate the string by K character from the end.
Type 2- Print the Character at the I'th index of the resulting string at that Instant.
Now, Pasha wants to perform the 2 types of queries, But he is too lazy to do it himself.
So, you need to help him.
The first line contains an integer T-denoting the test cases.
The first line of each test cases contains two integers- N (Length of the string) and Q(Number of queries),
The second line contains the String.
Then Each of the next Q lines contains Typ of the query and K or I.
For each query of Type 2, Output the character at the I'th index in a new line.
After First query String becomes -"fgabcde"
Second query returns - 'f'
Third query returns -'e'
After Fourth Query String becomes- "bcdefga"
Fifth Query returns -'c'
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.