#include <iostream>

using namespace std;

int main()
{
	int M,N,L;

	while(1)
	{
		int sum = 0;
		int count = 0;
		int ans;
		cin >> L;

		if(L == 0)
		{
			break;
		}

		for(int i = 1; i <= 12; i++)
		{

			cin >> M >> N ;

			sum += M - N;

			if(sum >= L && count < 1)
				{
					count++;
					ans = i;
				}
		}

		if(sum >= L && count < 2)
				{
					cout << ans << endl;
				}	
		else
		{
			cout << "NA" << endl;
		}
	}


	return 0;
}