=====Problem Statement=====
Consider a list (list = []). You can perform the following commands:
1. insert i e: Insert integer e at position i.
2. print: Print the list.
3. remove e: Delete the first occurrence of integer e.
4. append e: Insert integer e at the end of the list.
5. sort: Sort the list.
6. pop: Pop the last element from the list.
7. reverse: Reverse the list.
Initialize your list and read in the value of n followed by n lines of commands where each command will be 7 of the types listed above. Iterate through each command in order and perform the corresponding operation on your list.

=====Example=====
N = 4
append 1
append 2
insert 3 1
print
append 1: Append 1 to the list, arr = [1].
append 2: Append 2 to the list, arr = [1,2].
insert 3 1: Insert 3 at index 1, arr = [1,3,2].
print: Print the array
Output:
[1, 3, 2]

=====Input Format=====
The first line contains an integer, n, denoting the number of commands. Each line i of the subsequent n lines contains one of the commands described above.

=====Constraints=====
The elements added to the list must be integers

=====Output Format=====
For each command of type print, print the list on a new line.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '# Enter your code here. Read input from STDIN. Print output to STDOUT\nar=[]\nn=int(input())\nfor i in range(0,n):\n    tmp_str=input()\n    tmp_str_ar=tmp_str.strip().split(" ")\n    cmd=tmp_str_ar[0]\n    if(cmd=="print"):\n        print(ar)\n    elif(cmd=="sort"):\n        ar.sort()\n    elif(cmd=="reverse"):\n        ar.reverse()\n    elif(cmd=="pop"):\n        ar.pop()\n    elif(cmd=="count"):\n        val=int(tmp_str_ar[1])\n        ar.count(val)\n    elif(cmd=="index"):\n        val=int(tmp_str_ar[1])\n        ar.index(val)\n    elif(cmd=="remove"):\n        val=int(tmp_str_ar[1])\n        ar.remove(val)  \n    elif(cmd=="append"):\n        val=int(tmp_str_ar[1])\n        ar.append(val)          \n    elif(cmd=="insert"):\n        pos=int(tmp_str_ar[1])\n        val=int(tmp_str_ar[2])\n        ar.insert(pos,val)\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13647