import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main{
   private static Scanner s = new Scanner(System.in) ;
   public static void main(String[] args) {
	  int n = s.nextInt() ;
	  
	  List<Integer> list = new LinkedList<Integer>() ;
	  int a[] = new int[n] ;
	  for (int i = 0; i < n; i++) {
		  int temp = s.nextInt() ;
		  a[i] = temp ;
		  
	  }
	  
	  for (int i = a.length-1;i>=0 ; i--) {
		list.add(a[i]) ;
	}
	  int m = s.nextInt() ;
	  s.nextLine() ;
	  for (int i = 0; i < m; i++) {
		 String str = s.nextLine() ;
		 f(list, str);
	  }
   }
   static void f(List<Integer>list , String str){
	   String strs[] = str.split("\\s+") ;
	   if(strs[0].equals("show")){
		   show(list);
	   }else if(strs[0].equals("delete")){
		   delete(list, Integer.parseInt(strs[1])-1);
	   }else if(strs[0].equals("insert")){
		   insert(list, Integer.parseInt(strs[1])-1, Integer.parseInt(strs[2]));
	   }else if(strs[0].equals("get")){
		   get(list, Integer.parseInt(strs[1])-1);
	   }
   }
   static void show(List<Integer> list){
	   if(list.size()==0){
		   System.out.println("Link list is empty");
	   }else {
	   for (int i = 0; i < list.size(); i++) {
		  if (i==list.size()-1) {
			System.out.println(list.get(i)) ;
		  }
		  else {
			  System.out.print(list.get(i)+" ");
		  }
	   }
	   }
   }
   
   static void delete(List<Integer> list,int i){
	   try{
	      list.remove(i) ;
	      System.out.println("delete OK");
	   }catch(Exception e){
		   System.out.println("delete fail");
	   }
   }
   
   static void insert(List<Integer> list,int i , int j){
	   try{
	     list.add(i, j);
	     System.out.println("insert OK");
	   }catch(Exception e){
		   System.out.println("insert fail") ;
	   }
   }
   
   static void get(List<Integer> list,int i){
	   try {
		System.out.println(list.get(i)) ;
		
	} catch (Exception e) {
		// TODO: handle exception
		System.out.println("get fail");
	}
   }
}

/**************************************************************
	Problem: 2138
	User: admin
	Language: Java
	Result: Memory Limit Exceed
****************************************************************/