#include<iostream>
using namespace std;
int main() {
	int month[1001];
	long m, n, l, y = 0, k = 0;
	int x;
	for (int i = 0; i < 1001; i++){
		month[i] = 0;
	}
	for (int i = 0;; i++){
		k = 0;
		cin >> l;
		if (l == 0){
			x = i;
			break;
		}
		for (int j = 0; j < 12; j++){
			cin >> m >> n;
			y += (m - n);
			if (y >= l&&k == 0) {
				k = j;
				month[i] = k;
			}
		}
	}
	for (int i = 0; i < x; i++){
		if (month[i] == 0){
			cout << "NA";
		}
		else cout << month[i]+1;
		cout << endl;
	}
}