''' import os os.chdir("C:\Users\jborthen\Desktop\Python\HackerRank") execfile("python-lists.py") ''' N=int(raw_input()) L=[] for i in range(0,N): current_input=str(raw_input()) current_command = str(current_input.split(" ")[0]) if (current_command == "insert"): L.insert(int(current_input.split(" ")[1]),int(current_input.split(" ")[2])) elif (current_command == "print"): print L elif (current_command == "remove"): L.remove(int(current_input.split(" ")[1])) elif (current_command == "append"): L.append(int(current_input.split(" ")[1])) elif (current_command == "reverse"): L.reverse() elif (current_command == "pop"): temp = L.pop() elif (current_command == "sort"): L.sort() elif (current_command == "index"): temp = L.index(int(current_input.split(" ")[1]))