1public static void main(String[] args) {
2 /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
3 Scanner in = new Scanner(System.in);
4 int n = in.nextInt();
5 int q = in.nextInt();
6 int[] arr = new int[n];
7 for(int ar_i = 0; ar_i < n; ar_i++){
8 arr[ar_i] = ar_i+1;
9 }
10 for(int ind=1;ind<=q+1;ind++){
11 int a = in.nextInt();
12 if(1==a){
13 reverseSubArray(arr, in.nextInt()-1, in.nextInt()-1);
14 }else if(2==a){
15 int b = in.nextInt();
16 for(int i=0;i<arr.length;i++){
17 if(arr[i]==b){
18 System.out.println("element "+ b +" is at position "+ (i+1));
19 break;
20 }
21 }
22 }else if(3==a){
23 int b = in.nextInt();
24 System.out.println("element at position " + b + " is " + arr[b-1]);
25 }
26 }
27 }
28
29 static void reverseSubArray(int arr[], int i, int j){
30 if(i>=j) return;
31 for(;i<j;i++,j--){
32 int temp = arr[i];
33 arr[i]=arr[j];
34 arr[j]=temp;
35 }
36 }
37
1/* Enter your code here. Read input from STDIN. Print output to STDOUT */
2int main()
3{
4int n,q,x,y,z,t;
5scanf("%d %d",&n,&q);
6int a[n];
7for(int i=0;i<n;i++)
8{
9 a[i]=i+1;
10}
11for(int j=0;j<q;j++)
12{
13 scanf("%d",&x);
14 if(x==1)
15 {
16 int temp=0;
17 scanf("%d",&y);
18 scanf("%d",&z);
19 t=z-y+1;
20 y--;
21 z--;
22
23 for(int j=0;j<t/2;j++)
24 {
25 temp=a[y+j];
26 a[y+j]=a[z-j];
27 a[z-j]=temp;
28 }
29
30 else if(x==2)
31 {
32 int t=0;
33 scanf("%d",&y);
34 for(int i=0;i<n;i++)
35 {
36 if(a[i]==y)
37 {
38 t=i;
39 break;
40 }
41 }
42 printf("element %d is at position %d\n",y,t+1);
43 }
44 else
45 {
46 scanf("%d",&y);
47 printf("element at position %d is %d \n",y,a[y-1]);
48 }
49
50}
51return 0;
52
1n,queries=map(int,input().split())
2num=[i+1 for i in range(n)]
3for i in range(queries):
4 l=list(map(int,input().split()))
5 if len(l)==3:
6 if l[1]==1:
7 num=num[:l[1]-1]+num[l[2]-1::-1]+num[l[2]:]//1
8 else:
9 num=num[:l[1]-1]+num[l[2]-1:l[1]-2:-1]+num[l[2]:]//1
10 elif l[0]==2:
11 print("element {0} is at position {1}".format(l[1],num.index(l[1])+1))//2
12 else:
13 print("element at position {0} is {1}".format(l[1],num[l[1]-1]))
14