The problem involves managing a dynamic array of integers, denoted as $A = \{a_0, a_1, ...\}$. Operations include adding an element at the end of $A$ (pushBack), printing a specific element ($a_p$) at index $p$ (randomAccess), and deleting the last element of $A$ (popBack). The array $A$ is initially empty and is 0-indexed.

Input:
The input consists of a number $q$ followed by $q$ queries. Each query is represented as:
- 0 $x$: to add element $x$ at the end of $A$
- 1 $p$: to print element $a_p$
- 2: to delete the last element of $A$

Output:
For each randomAccess operation, 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

# Buggy version:
# -*- coding: utf-8 -*-

from collections import deque

n = int(input())
word = deque()

for i in range(n):
    command, num = map(int, input().split())
    if command == 0:
        word.append(num)
    elif command == 1:
        print('{0}'.format(word[num]))
    elif command == 2:
        word.pop()



# Fixed version:
# -*- coding: utf-8 -*-

from collections import deque

n = int(input())
word = deque()

for i in range(n):
    command = list(map(int, input().split()))
    if command[0] == 0:
        word.append(command[1])
    elif command[0] == 1:
        print('{0}'.format(word[command[1]]))
    elif command[0] == 2:
        word.pop()

# Buggy version:
from sys import stdin
from collections import deque

num = int(input())

q = deque()

for i in range(num):

	cmd = stdin.readline().strip().split()

	if cmd[0] == "0":
		#末尾に挿入
		q.append(cmd[1])

	elif cmd[0] == "1":
		#要素の出力
		print(q[int(cmd[1])])
	else:
		#末尾の削除
		q.pop()

print(*q,sep='\n')




# Fixed version:
from sys import stdin
from collections import deque

num = int(input())

q = deque()

for i in range(num):

	cmd = stdin.readline().strip().split()

	if cmd[0] == "0":
		#末尾に挿入
		q.append(cmd[1])

	elif cmd[0] == "1":
		#要素の出力
		print(q[int(cmd[1])],sep='\n')
	else:
		#末尾の削除
		q.pop()

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


# Fixed version:
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)

# Buggy version:
def pushBack(lists, x):
	return lists.insert(-1, x)

def randomAccess(lists, p):
	print(lists[p])

def popBack(lists):
	return lists.pop(-1)

if __name__ == '__main__':
	l = list()
	n = int(input())
	for i in range(n):
		j= input().split()

		if int(j[0]) == 0:
			pushBack(l, x)
		elif int(j[0]) == 1:
			randomAccess(l, x)
		else:
			popBack(l)



# Fixed version:
def pushBack(lists, x):
    return lists.insert(len(lists), x)

def randomAccess(lists, p):
    print(lists[p])

def popBack(lists):
    return lists.pop(len(lists) - 1)

if __name__ == '__main__':
    l = list()
    n = int(input())
    for i in range(n):
        j= input().split()

        if int(j[0]) == 0:
            pushBack(l, int(j[1]))
        elif int(j[0]) == 1:
            randomAccess(l, int(j[1]))
        else:
            popBack(l)

# Buggy version:
# AOJ ITP2_1_A: Vector
# Python3 2018.6.24 bal4u

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


# Fixed version:
# AOJ ITP2_1_A: Vector
# Python3 2018.6.24 bal4u

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