import std.stdio, std.string, std.array, std.conv;

void main() {
    int[] a;
    int q = readln.chomp.to!int;
    foreach (i; 0 .. q) {
        int[] tmp = readln.chomp.split.to!(int[]);
        if (tmp[0] == 0) {
            a ~= tmp[1];
        } else if (tmp[0] == 1) {
            a[tmp[1]].writeln;
        } else {
            a = a[0..$-1];
        }
    }
}
