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

void main() {
    int N = readln.chomp.to!int;
    auto c = readln.chomp.split.map!(to!int).array;
    int Q = readln.chomp.to!int;
    bool flag = true;

    int[] apple = new int[](N);

    for (int i = 0; i < Q; i++) {
        auto operation = readln.chomp.split.map!(to!int).array;
        int x = operation[1] - 1, d = operation[2];

        if (!flag) {
            continue;
        }

        if (operation[0] == 1) {
            if (apple[x] + d <= c[x]) {
                apple[x] += d;
            }
            else {
                writeln(x + 1);
                flag = false;
            }
        }
        else {
            if (apple[x] - d >= 0) {
                apple[x] -= d;
            }
            else {
                writeln(x + 1);
                flag = false;
            }
        }
    }

    if (flag) {
        0.writeln;
    }

    return;
}
