Problem:
Vector For a dynamic array $A = \{a_0, a_1, ...\}$ of integers, perform a sequence of the following operations:  pushBack($x$): add element $x$ at the end of $A$  randomAccess($p$):print element $a_p$  popBack(): delete the last element of $A$  $A$ is a 0-origin array and it is empty in the initial state. Input The input is given in the following format. $q$
$query_1$
$query_2$
:
$query_q$ Each query $query_i$ is given by 0 $x$ or 1 $p$ or 2 where the first digits 0 , 1 and 2 represent pushBack, randomAccess and popBack operations respectively. randomAccess and popBack operations will not be given for an empty array. Output For each randomAccess, print $a_p$ in a line. Constraints  $1 \leq q \leq 200,000$  $0 \leq p < $ the size of $A$  $-1,000,000,000 \leq x \leq 1,000,000,000$  Sample Input 1 8
0 1
0 2
0 3
2
0 4
1 0
1 1
1 2 Sample Output 1 1
2
4

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    n=int(input())
    aa=[]
    for _ in range(n):
        qq=list(map(int, input().split()))
        if qq[0]==0:aa.append(qq[1])
        elif qq[0]==1:print(aa[qq[1]])
        else:aa.pop()

main()

Solution (Python):
class Vector:


    def __init__(self):
        self.a = []

    def pushBack(self, x):
        self.a.append(x)

    def randomAccess(self, p):
        print(self.a[p])

    def popBack(self):
        self.a = self.a[:-1]


v = Vector()

n = int(input())
for i in range(n):
    q_str =  input().split()
    q = int(q_str[0])
    if q == 0:
        v.pushBack(int(q_str[1]))
    elif q  == 1:
        v.randomAccess(int(q_str[1]))
    else:
        v.popBack()

Solution (Python):
def main():
    A=[]
    box=[]
    q=int(input())
    for i in range(q):
        query=input()
        if query.isdigit():
            A.pop(-1)
        else:
            que,num=map(int,query.split())
            if que==0:
                A.append(num)
            elif que==1:
                box.append(A[num])

    for a in box:
        print(a)

if __name__=='__main__':
    main()

Solution (Python):
n = int(input())
a = []
for i in range(n):
    cmd = list(map(int, input().split()))
    if cmd[0] == 0:
        a.append(cmd[1])
    elif cmd[0] == 1:
        print(a[cmd[1]])
    elif cmd[0] == 2:
        a.pop(-1)

Solution (Python):
q = int(input())
a = []

for i in range(q):
    p = input().split()
    if p[0] == '0':
        a.append(p[1])
    elif p[0] == '1':
        print(a[int(p[1])])
    else:
        a.pop(-1)

Solution (Python):
q = int(input())
A = []
for _ in range(q):
    n, *x = map(int, input().split())
    if n == 0:
        A.append(x)
    elif n == 1:
        print(A[x[0]][0])
    else:
        A.pop(-1)

Solution (Python):
n=int(input())
que=[]

for i in range(n):
    command=list(map(str,input().split()))
    if command[0]=="0":
        que.append(int(command[1]))
    elif command[0]=="1":
        print(que[int(command[1])])
    elif command[0]=="2":
        que.pop()

Solution (Python):
import sys
q = int(input())

ans = []
d = []
for i in range(q):
    
    a = sys.stdin.readline()
    
    if a[0] == '0':
        d.append(a[2:])
    elif a[0] == '1':
        ans.append(d[int(a[2:])])
    else:
        d.pop(-1)
for i in ans:
    print(i.strip())

Solution (Python):




A = []
n = int(input())

for _ in range(n):
    command = input()
    if command == "2":
        A.pop()
    else:
        command, value = command.split()
        if command == "0":
            A.append(int(value))
        else:
            print(A[int(value)])

Solution (Python):
q = int(input())
A = []
for i in range(q):
    com = list(map(int, input().split()))
    if com[0] == 0:
        A.append(com[1])
    elif com[0] == 1:
        print(A[com[1]])
    else:
        A.pop()

Solution (Python):
class Vector:
    def __init__(self):
        self._container = []
    
    def pushback(self, x):
        self._container.append(x)
    
    def randomAccess(self, index):
        return self._container[index]
    
    def popback(self):
        return self._container.pop()
        
num_operations = int(input())
vector = Vector()

for _ in range(num_operations):
    line = input()
    if line[0] in ('0', '1'):
        operation, target = line.split()
        target = int(target)
    else:
        operation = line[0]
        
    if operation == '0':
        vector.pushback(target)
    elif operation == '1':
        print(vector.randomAccess(target))
    elif operation == '2':
        vector.popback()

Solution (Python):
from collections import deque
q=deque([])
_,*l=open(0)
for x in l:
    if x[0]=="2":q.pop()
    else:
        a,b=map(int,x.split())
        if a==0:q.append(b)
        else:print(q[b])

Solution (Python):
n=int(input())
S = [list(map(int, input().split())) for i in range(n)]
A=[]
for i in range(n):
  if S[i][0]==0:
    A.append(S[i][1])
  elif S[i][0]==1:
    try:
      print(A[S[i][1]])
    except AttributeError:
      pass
  elif S[i][0]==2:
    try:
      A.pop()
    except AttributeError:
      pass

Solution (Python):
queue = []

for i in range(int(input())):
    query = list(map(int, input().split()))
    
    if query[0] == 0:
        queue.append(query[1])
    elif query[0] == 1:
        print(queue[query[1]])
    else:
        queue.pop()

Solution (Python):
lists = []
n = int(input())
 
for i in range(n):
    query = list(map(int, input().split()))
    if(query[0] == 0):
        lists.append(query[1])
    elif(query[0] == 1):
        print(lists[query[1]])
    elif(query[0] == 2):
        lists.pop()

Solution (Python):

num = int(input())

l = []

for i in range(num):
    c = [int(x) for x in input().split()]
    if c[0]== 0:
        l.append(c[1])
    elif c[0] ==1:
        print(l[c[1]])
    elif c[0] ==2:
        del(l[-1:])

Solution (Python):
from typing import List


if __name__ == "__main__":
    num_query = int(input())
    vector: List[int] = []
    for _ in range(num_query):
        op, *value = map(lambda x: int(x), input().split())
        if (0 == op):
            vector.append(value[0])
        elif (1 == op):
            print(f"{vector[value[0]]}")
        elif (2 == op):
            vector.pop()
        else:
            pass

Solution (Python):
q = int(input())

ans = []

for _ in range(q):
    x = input().split()

    if x[0] == "0":
        ans.append(x[1])
    elif x[0] == "1":
        print(ans[int(x[1])])
    else:
        ans.pop()

Solution (Python):
from collections import deque
n=int(input())
Deq=deque()
for i in range(n):
    command=input().split( )
    com=int(command[0])
    if len(command)>1:
        com1=int(command[1])
    if com==0:
        Deq.append(com1)
    elif com==1:
        q=Deq[com1]
        print(q)
    elif com==2:
        del Deq[-1]

Solution (Python):
from collections import deque

q = int(input())
a = deque()
for _ in range(q):
    op = list(map(int, input().split()))
    if op[0] == 0:
        a.append(op[1])
    elif op[0] == 1:
        print(a[op[1]])
    elif op[0] == 2:
        a.pop()

Solution (Python):
N = int(input())

A = []

for _ in range(N):
    x = list(map(int, input().split()))
    if x[0] == 0:
        A.append(x[1])
    if x[0] == 1:
        print(A[x[1]])
    if x[0] == 2:
        A.pop()

Solution (Python):
n = int(input())
l = []
for i in range(n):
    x = input()
    if x[0] == "0":
        a, b = map(int, x.split())
        l.append(b)
    elif x[0] == "1":
        a, b = map(int, x.split())
        print(l[b])
    elif x[0] == "2":
        del l[-1]

Solution (Python):
A = []
ans = []
for i in range(int(input())):
    query = list(map(int, input().split()))
    if(query[0] == 0):
        A.append(query[1])
    elif(query[0] == 1):
        ans.append(A[query[1]])
    else:
        A.pop()
for i in range(len(ans)):
    print(ans[i])

Solution (Python):
a = int(input())

res = []
for i in range(a):
    temp = list(map(int, input().split()))
    if temp[0] == 0:
        res.append(temp[1])
    elif temp[0] == 1:
        print(res[temp[1]])
    else:
        res.pop()

Solution (Python):
q = int(input())
A = []

for i in range(q):
    Q, *x = (int(x) for x in input().split())
    x = x[0] if x else None
    if Q == 0:
        A.append(x)
    elif Q == 1:
        print(A[x])
    else:
        del A[-1]

Solution (Python):
n = int(input())
lst = []
for i in range(n):
    lst1 = list(map(int,input().split()))
    lst.append(lst1)
vec = []
for i in range(n):
    if lst[i][0]==0:
        vec.append(lst[i][1])
    elif lst[i][0]==2:
        vec.pop()
    else:
        print(vec[lst[i][1]])

Solution (Python):
from collections import deque
q=int(input())
a=deque([])
for i in range(q):
    query=input()
    if query=="2":
        a.pop()
        continue
    que,x=query.split()
    if que=="1":
        print(a[int(x)])
    else:
        a.append(x)

Solution (Python):
q = int(input())
A = []
 
for i in range(q):
    Q, *x = (int(x) for x in input().split())
    x = x[0] if x else None
    if Q == 0:
        A.append(x)
    elif Q == 1:
        print(A[x])
    else:
        del A[-1]

Solution (Python):
q = int(input())
ans = []
for i in range(q):
    a = list(map(int, input().split()))
    if a[0] == 0: ans.append(a[1])
    elif a[0]==1: print(ans[a[1]])
    else: ans.pop()

Solution (Python):
from collections import deque
Q = deque()
q = int(input())
for i in range(q):
    a = input()
    if   a[0] == '0': Q.append(a[2:])      
    elif a[0] == '1': print(Q[int(a[2:])]) 
    else:             Q.pop()

Solution (Python):
def solve():
    A = []

    import sys
    f_i = sys.stdin
    q = f_i.readline()
    
    ans = []
    for q in f_i:
        if q[0] == '0':
            A.append(q[2:])
        elif q[0] == '1':
            ans.append(A[int(q[2:])])
        else:
            A.pop()
    print(''.join(ans), end='')

solve()

Solution (Python):
Q = int(input())
querys = [[int(x) for x in input().split()] for _ in range(Q)]
def execute_query(lst,op):
    if len(op)==2 and op[0]==0:
        lst.append(op[1])
        return lst
    if len(op)==2 and op[0]==1:
        print(lst[op[1]])
        return lst
    else:
        return lst[:-1]
       
lst=[] 
for q in querys:
    lst=execute_query(lst,q)

Solution (Python):
q = int(input())
vec = []
for i in range(q):
    a = list(map(int, input().split()))
    k = a[0]
    if k == 0:
        vec.append(a[1]) 
    if k == 1:
        print(vec[a[1]])
    if k == 2:
        vec.pop(-1)

Solution (Python):
A=[]
q=int(input())
for i in range(1,q+1):
    query=list(map(int,input().split()))
    if query[0]==0:
        A.append(query[1])
    elif query[0]==1:
        print(A[query[1]])
    elif query[0]==2:
        A.pop()

Solution (Python):
q=int(input())
query=[]
A=[]
for i in range(q):
    query=list(map(int,input().split()))
    if query[0]==0:
        A.append(query[1])
    elif query[0]==1:
        print(A[query[1]])
    else:
        A.pop(-1)

Solution (Python):

"""
Dynamic Arrays and List - Vector
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_1_A&lang=jp

"""
import sys


class Vector:
    def __init__(self):
        self.n = 0
        self.d = dict()

    def push(self, x):
        self.d[self.n] = x
        self.n += 1

    def access(self, p):
        return self.d[p]

    def pop(self):
        self.n -= 1


def main(args):
    v = Vector()
    q = int(input())
    for _ in range(q):
        op, x = (input() + ' 1').split()[:2]
        if op == '0':
            v.push(int(x))
        elif op == '1':
            print(v.access(int(x)))
        else:
            v.pop()


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
q = int(input())
a_list = [0]*q
pos = 0
for _ in range(q):
    com, *x = map(int, input().split())
    if com == 0:
        a_list[pos] = x[0]
        pos += 1
    elif com == 1:
        print(a_list[x[0]])
    else:
        pos -= 1

Solution (Python):
cnt = int(input())
a = []
for i in range(cnt):
    li = list(map(int,input().split()))
    if li[0] == 0:
        a.append(li[1])
    elif li[0] ==1:
        print(a[li[1]])
    else:
        a.pop(-1)

Solution (Python):
import sys
q = int(input())
v = []
for _ in range(q):
    s = sys.stdin.readline()
    if s[0] == '2':
        v.pop()
    else:
        c, x = map(int, s.split())
        if c == 0:
            v.append(x)
        else:
            sys.stdout.write("{}\n".format(v[x]))

Solution (Python):
class Operation():
    def __init__(self, num_list):
        self.num_list = num_list
        
    def ope(self, queries):
        q = queries[0]
        
        if q == 0:
            self.pushBack(queries[1])
        elif q == 1:
            self.randomAccess(queries[1])
        elif q == 2:
            self.popBack()
    
    def pushBack(self, x):
        
        self.num_list.append(x)
    def randomAccess(self, p):
        
        if len(self.num_list) >= p + 1:
            print(self.num_list[p])
    def popBack(self):
        if len(self.num_list) > 0:
            self.num_list.pop(-1)
    

x = int(input())
op = Operation(list())
for i in range(x):
    op.ope(list(map(int,input().split())))

Solution (Python):



class Vector(object):
    def __init__(self):
        self.A = list()

    def pushBack(self, x):
        self.A.append(x)

    def randomAccess(self, p):
        print self.A[p]

    def popBack(self):
        del self.A[-1]

A = Vector()
q = int(raw_input())
for i in range(q):
    line = [int(i) for i in raw_input().split()]
    if line[0] == 0:
        A.pushBack(line[1])
    elif line[0] == 1:
        A.randomAccess(line[1])
    else:
        A.popBack()

Solution (Python):
n = int(input())
A = []
for i in range(n):
    x = list(map(int, input().split()))
    
    if x[0] == 0:
        A.append(x[1])
    elif x[0] == 1:
        print(A[x[1]])
    elif x[0] == 2:
        del A[-1]

Solution (Python):
end = 0
ans = [0]
def pushBack(x):
    global end, ans
    ans[end] = x
    end += 1
    if end >= len(ans):
        ans.append(0)

def randomAccess(p):
    global ans
    print(ans[int(p)])

def popBack():
    global end
    end -= 1

q = int(input())
for i in range(q):
    query = list(input().split())
    if query[0] == "0":
        pushBack(query[1])
    elif query[0] == "1":
        randomAccess(query[1])
    else:
        popBack()

Solution (Python):
num = int(input())
A = []
for i in range(num):
    order = list(map(int, input().split()))
    if order[0] == 0:
        A.append(order[1])
    if order[0] == 1:
        print(A[order[1]])
    if order[0] == 2:
        del A[-1:]

Solution (Python):
import sys

n = int(sys.stdin.readline())

que = list()

for i in range(n):
    query = sys.stdin.readline().split()
    if query[0] == '0': 
        que.append(query[1])
    elif query[0] == '1':
        print(que[int(query[1])])
    elif query[0] == '2':
        que.pop()

Solution (Python):
q = int(input())

A = []

for _ in range(q):
    
    command, *list_num = input().split()

    if   command == "0":
        A.append(int(list_num[0]))
    elif command == "1":
        print(A[int(list_num[0])])
    elif command == "2":
        A.pop()
    else:
        raise

Solution (Python):
lst = []
for _ in range(int(input())):
    moji = input().split()
    method = moji[0]
    if len(moji) == 2:
        x = moji[1]
    if method == "0":
        lst.append(x)
    elif method == "1":
        print(lst[int(x)])
    elif method == "2":
        del lst[-1]

Solution (Python):
def vec(ap):
    input_line = input()
    x = input_line.split()
    query = [int(s) for s in x]
    if query[0] == 0:
        ap.append(query[1])
    elif query[0] == 1:
        ap_out = ap[query[1]]
        print(ap_out)
    elif query[0] == 2:
        del ap[-1]
    x = []
    s = []
    input_line = 0
    return ap

x = []
ap = []
input_num = int(input())
for a in range(input_num):
    vec(ap)

Solution (Python):
from collections import deque
Q = deque()
q = int(input())
for i in range(q):
    a = input()
    if   a[0] == '0': Q.append(a[2:])      
    elif a[0] == '1': print(Q[int(a[2:])]) 
    else:             Q.pop()

Solution (Python):
from collections import deque
box = deque()
n = int(input())
for _ in range(n):
    a, *b = map(int, input().split())
    if a == 0:
        box.append(b[0])
    elif a == 1:
        print(box[b[0]])
    else:
        box.pop()

Solution (Python):
a = []
q = int(input())
for i in range(q):
  order = list(input().split())
  if int(order[0]) == 0:
    x = int(order[1])
    a.append(x)
  if int(order[0]) == 1:
    p = int(order[1])
    print(a[p])
  if int(order[0]) == 2:
    del a[len(a)-1]

Solution (Python):
from collections import deque
Q = deque()
q = int(input())
for i in range(q):
    a = input()
    if   a[0] == '0': Q.append(a[2:])
    elif a[0] == '1': print(Q[int(a[2:])])
    else:             Q.pop()

Solution (Python):
a=[]
q=int(input())

def pushback(a,x):
    a.append(x)
    return a

def randomaccess(a,p):
    print(a[p])

def popback(a):
    a.pop(len(a)-1)
    return a

for i in range(q):
    query=list(map(int,input().split()))
    if query[0]==0:
        a=pushback(a,query[1])
    elif query[0]==1:
        randomaccess(a,query[1])
    else:
        a=popback(a)

Solution (Python):
A=[]
def pushBack(x):
    A.append(x)
def randomAccess(x):
    if len(A)==0:
        return
    print(A[x])
def popBack():
    if len(A)==0:
        return
    A.pop()
q=int(input())
for i in range(q):
	a=list(map(int,input().split()))
	if a[0]==0:
		pushBack(a[1])
	elif a[0]==1:
		randomAccess(a[1])
	elif a[0]==2:
		popBack()

Solution (Python):
q = int(input())
list_A = []
for q in range(q):
    query = list(input().split())
    if int(query[0]) == 0:
        list_A.append(query[1])
    elif int(query[0]) == 1:
        print(list_A[int(query[1])])
    else:
        list_A.pop(len(list_A)-1)

Solution (Python):
N= int(input())
P = []
for i in range(N):
    a, *b = (int(b) for b in input().split())
    b= b[0] if b else None
    if a == 0:
        P.append(b)
    elif a == 1:
        print(P[b])
    else:
        del P[-1]

Solution (Python):
A = [int(input())]
def pushBack(x):
	A.append(x)
def randomAccess(p):
	print(A[p+1])
def popBack():
	del A[-1]
while(1):
	try:
		a = input()
		if " " in a:
			b,c = [int(i) for i in a.split()]
			if b == 0:
				pushBack(c)
			else:
				randomAccess(c)
		else:
			popBack()
	except EOFError:
		break

Solution (Python):

n = int(input())

values = []

for i in range(n):
    query = list(map(int, input().split()))
    operation = query[0]
    if operation == 0: 
        value = query[1]
        values.append(value)
    elif operation == 1: 
        position = query[1]
        print(values[position])
    else:
        values.pop(-1)

Solution (Python):
q = int(input())
A = []

for i in range(q):
    Q, *x = (int(x) for x in input().split())
    x = x[0] if x else None
    if Q == 0:
        A.append(x)
    elif Q == 1:
        print(A[x])
    else:
        del A[-1]

Solution (Python):
n = int(input())

values = []
for i in range(n):
    query = list(map(int, input().split()))
    operation = query[0]
    if operation == 0:
        values.append(query[1])
    elif operation == 1:
        print(values[query[1]])
    else:
        values.pop(-1)

Solution (Python):
n=int(input())
a=[]
for i in range(n):
    x=list(map(int, input().split()))
    if x[0]==0:a.append(x[1])
    if x[0]==1:print(a[x[1]])
    if x[0]==2:a.pop()

Solution (Python):
n = int(input())
ans = []

for i in range(n):
	lst = list(map(int,input().split()))
	if lst[0] == 0:
		ans.append(lst[1])
	elif lst[0] == 1:
		print(ans[lst[1]])
	else:
		del ans[-1]

Solution (Python):


lists = []
n = int(input())

for i in range(n):
    query = list(map(int, input().split()))
    if(query[0] == 0):
        lists.append(query[1])
    elif(query[0] == 1):
        print(lists[query[1]])
    elif(query[0] == 2):
        lists.pop()

Solution (Python):
li=[]
for i in range(int(input())):
	req=list(map(int,input().split()))
	if req[0]==0:
		li.append(req[1])
	elif req[0]==1:
		print(li[req[1]],end='\n')
	else:
		del li[len(li)-1]

Solution (Python):
A = []

for i in range(int(input())):
    a = [int(j) for j in input().split()]
    if a[0] == 0:
        x = a[1]
        A.append(x)
    elif a[0] == 1:
        p = a[1]
        print(A[p])
    else:
        A.pop()

Solution (Python):
if __name__ == '__main__':
    a = []
    anslst = []
    n = int(input())
    for i in range(n):
        l = list(map(int, input().split()))
        if l[0] == 0:
            a.append(l[1])
        elif l[0] == 1:
            anslst.append(a[l[1]])
        else:
            a.pop()
    for n in anslst:
        print(n)

Solution (Python):
import sys
nq = int(input())
lines = sys.stdin.readlines()
vector = []
for i in range(nq):
    query, *arg = lines[i].split()
    if query == '0':    
        vector.append(arg[0])
    elif query == '1':  
        print(vector[int(arg[0])])
    elif query == '2':    
        vector.pop()
    else:
        raise AssertionError

Solution (Python):
n=int(input())
l=[]
for i in range(n):
    q=list(map(int,input().split()))
    if q[0]==0:
        l.append(q[1])
    elif q[0]==1:
        print(l[q[1]])
    else:
        del l[-1]

Solution (Python):



wl = []
for i in range(0,int(input())):
    l = list(map(str,input().split()))
    c = int(l[0])

    if ( c == 0 ):
        d = int(l[1])
        wl.append(d)
    elif(c == 1):
        d = int(l[1])
        print (wl[d])
    elif(c == 2):
        wl.pop()

Solution (Python):
import sys
sys.stdin.readline()
A = []
ans = []
operations = {'0': A.append, '1': lambda x: ans.append(A[int(x)]), '2': A.pop}
for query in sys.stdin:
    operations[query[0]](query[2:] if query[2:] else -1)
sys.stdout.writelines(ans)

Solution (Python):
readline = open(0).readline
writelines = open(1, 'w').writelines
Q = int(readline())
ans = []
A = []
def access(p):
    ans.append("%d\n" % A[p])


C = [A.append, access, A.pop].__getitem__
for i in range(Q):
    t, *a=map(int, readline().split())
    C(t)(*a)
writelines(ans)

Solution (Python):

def pushBack(ary, elem):
    ary.append(elem)


def randomAccess(ary, idx):
    print(ary[idx])


def popBack(ary):
    ary.pop()


def main():
    n = int(input())
    ary = []
    for i in range(n):
        query = input()
        if (query[0] == '0'):
            elem = int(query[2:])
            pushBack(ary, elem)
        elif (query[0] == '1'):
            idx = int(query[2:])
            randomAccess(ary, idx)
        elif (query[0] == '2'):
            popBack(ary)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())

anslist = []
printlist = []

for i in range(n):
    query = list(map(int, input().split()))
    if query[0] == 0:
        anslist.append(query[1])
    elif query[0] == 1:
        printlist.append(anslist[query[1]])
    elif query[0] == 2:
        anslist.pop(-1)

for p in printlist:
    print(p)

Solution (Python):
n = int(input())
A = []
for i in range(n):
    query = list(map(int, input().split()))
    if query[0] == 0:
        A.append(query[1])
    elif query[0] == 1:
        print(A[query[1]])
    else:
        A.pop()

Solution (Python):
n = int(input())
A = []

for i in range(n):
    li = [int(j) for j in input().split()]
    if li[0] == 0:
        A.append(li[1])
    elif li[0] == 2:
        A.pop()
    else:
        print(A[li[1]])

Solution (Python):
n = int(input())
a = []

for i in range(n):
    d = list(map(int, input().split()))
    if d[0] == 0:
        a.append(d[1])
    elif d[0] == 1:
        print(a[d[1]])
    elif d[0] == 2:
        a.pop()

Solution (Python):
def pushBack(x):
    A.append(x)
def randomAccess(p):
    print(A[p])
def popBack():
    A.pop()
A = []
N = int(input())
for i in range(N):
    S = list(map(int,input().split(" ")))
    if S[0] == 0:
        pushBack(S[1])
    elif S[0] == 2:
        popBack()
    else:
        randomAccess(S[1])

Solution (Python):



import sys

stack = list()
num_tc = int(sys.stdin.readline())

for i in range(num_tc):
    query = list(map(int, sys.stdin.readline().split()))
    if query[0] == 0:   
        stack.append(query[1])
    elif query[0] == 1:
        print(stack[query[1]])   
    elif query[0] == 2:
        stack.pop()     
    else:
        raise ValueError

Solution (Python):
A = []
queries = [input().split() for _ in range(int(input()))]
for query in queries:
    if query[0] == "0":
        A.append(int(query[1]))
    elif query[0] == "1":
        print(A[int(query[1])])
    elif query[0] == "2":
        A.pop()

Solution (Python):
n = int(input())
xlist = []
for i in range(n):
    order = list(map(int, input().split()))
    o = order[0] 
    if (o == 0):
        xlist.append(order[1])
    elif (o == 1):
        print(xlist[order[1]])
    elif (o == 2):
        del xlist[-1]

Solution (Python):
q = int(input())
l = []
for i in range(q):
    s = input()
    if s == "2":
        l.pop()
        continue
    else:
        c, n = map(int, s.split())
    if c == 0:
        l.append(n)
    else:
        print(l[n])

Solution (Python):
n = int(input())
a = []
for _ in range(n):
  q = list(map(int, input().split()))
  if q[0]==0:
    a.append(q[1])
  elif q[0]==1:
    print(a[q[1]])
  elif q[0]==2:
    a.pop()

Solution (Python):
numberOfQuery=int(input())
count=0
listForStock=[]
listForPrint=[]

def popBack():
    lastIndex=len(listForStock)-1
    del listForStock[lastIndex]

def pushBack(x):
    listForStock.append(x)

def randomAccess(p):
    listForPrint.append(listForStock[p])


while count<numberOfQuery:
    query=input()
    if query=="2":
        popBack()
    else:
        querys=query.split()
        if querys[0]=="0":
            pushBack(int(querys[1]))
        elif querys[0]=="1":
            randomAccess(int(querys[1]))
        else:
            print("入力が不正です")
            break
    count+=1

for chip in listForPrint:
    print(chip)