#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
	vector<int>l;
	long a, b, sum, need;
	while (cin >> need){
		sum = 0;
		if (need == 0){
			break;
		}
		bool b = false;
		for (int i = 0; i < 12; i++){
			cin >> a >> b;
			sum += a - b;
			if (sum >= need&&b == false) {
				b = true;
				l.push_back(i + 1);
			}
			if (i == 11 && sum < need){
				l.push_back(0);
			}
		}
	}
	for (int i = 0; i < l.size(); i++){
		if (l[i] == 0){
			cout << "NA";
		}
		else cout << l[i];
		cout << endl;
	}
}