# AOJ ITP2_1_A: Vector

# Python3 2018.6.24 bal4u



from collections import deque

Q = deque()

q = int(eval(input()))

for i in range(q):

	a = eval(input())

	if a[0] == '2': Q.pop()      # popBack

	else:

		id, v = list(map(int, a.split()))

		if id == 0: Q.append(v)  # pushBack

		else: print((Q[v]))        # randomAccess

# AOJ ITP2_1_A: Vector

# Python3 2018.6.24 bal4u



from collections import deque

Q = deque()

q = int(eval(input()))

for i in range(q):

	a = eval(input())

	if   a[0] == '0': Q.append(a[2:])      # pushBack

	elif a[0] == '1': print((Q[int(a[2:])])) # randomAccess

	else:             Q.pop()              # popBack

# AOJ ITP2_1_A: Vector
# Python3 2018.6.24 bal4u
from collections import deque

Q = deque()
q = int(eval(input()))
for i in range(q):
    a = eval(input())
    if a[0] == "2":
        Q.pop()  # popBack
    else:
        id, v = list(map(int, a.split()))
        if id == 0:
            Q.append(v)  # pushBack
        else:
            print((Q[v]))  # randomAccess

# AOJ ITP2_1_A: Vector
# Python3 2018.6.24 bal4u
from collections import deque

Q = deque()
q = int(eval(input()))
for i in range(q):
    a = eval(input())
    if a[0] == "0":
        Q.append(a[2:])  # pushBack
    elif a[0] == "1":
        print((Q[int(a[2:])]))  # randomAccess
    else:
        Q.pop()  # popBack

-    if a[0] == "2": +    if a[0] == "0": +        Q.append(a[2:])  # pushBack +    elif a[0] == "1": +        print((Q[int(a[2:])]))  # randomAccess +    else: -    else: -        id, v = list(map(int, a.split())) -        if id == 0: -            Q.append(v)  # pushBack -        else: -            print((Q[v]))  # randomAccess