#define _USE_MATH_DEFINES
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cmath>
#include<climits>
#include<map>
#include<string>
using namespace std;

int main(){
	int L, M, N;
	while(cin >> L, L){
		int sum = 0, ans = -1;
		for(int i = 1; i <= 12; i++){
			cin >> M >> N;
			sum += M - N;
			if(sum >= L && ans == -1) ans = i;
		}
		if(ans == -1) puts("NA");
		else printf("%d\n", ans);
	}
	return 0;
}