#include <bits/stdc++.h>
using namespace std;
#define int long long
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n)repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
typedef pair<int,int> P;
typedef pair<int, P> PP;
#define all(v) v.begin(),v.end()
#define fi first
#define se second
const int inf = 1e9;
int mod = 1e9+7;

int a[1001], b[1001];
signed main(){
	int n, q;
	scanf("%lld", &n);
	rrep(i,n)scanf("%lld", &a[i]);
	scanf("%lld", &q);
	
	int f = 0;
	rep(i,q){
		int x, y, z;
		scanf("%lld%lld%lld", &x, &y, &z);
		if(f)continue;
		if(x == 1){
			b[y] += z;
			if(a[y] < b[y]){
				printf("%lld\n", y);
				f = 1;
			}
		}else{
			b[y] -= z;
			if(b[y] < 0){
				printf("%lld\n", y);
				f = 1;
			}
		}
	}
	if(f == 0)printf("0\n");
	return 0;
}

