#list and its methods [https://www.hackerrank.com/challenges/python-lists]
12
insert 0 5
insert 1 10
insert 0 6
print
remove 6
append 9
append 1
sort
print
pop
reverse
print
[6, 5, 10]
[1, 5, 9, 10]
[9, 5, 1]
n = int(input())
samplelist = []
for times in range(n):
q = input()
qlist = q.split(" ")
if len(qlist) == 3:
command, x, y = qlist
x = int(x)
y = int(y)
if command == "insert":
samplelist.insert(x,y)
if len(qlist) == 2:
command, x = qlist
x = int(x)
if command == "remove":
samplelist.remove(x)
elif command == "append":
samplelist.append(x)
if len(qlist) == 1:
command = qlist[0]
if command == "print":
print(samplelist)
elif command == "pop":
samplelist.pop()
elif command == "reverse":
samplelist.reverse()
elif command == "sort":
samplelist.sort()