import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int T = sc.nextInt();
        String s = sc.next();
        StringBuilder sb = new StringBuilder(s);
        for(int i = 0; i < T; ++i){
            int a = sc.nextInt();
            int x = sc.nextInt();
            if(a == 1){//直接利用StringBuilder自带的子串方法进行拼接
                StringBuilder temp = new StringBuilder(sb.subSequence(0, N - x));
                sb = new StringBuilder(sb.subSequence(N - x, N)).append(temp);
            }else System.out.println(sb.charAt(x));
        }
    }
}