#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	int border;
	int a, b, sum, ans;
	bool ok;

	while(cin >> border ,border)
	{
		sum = 0;
		ok = false;
		for(int i = 1; i <= 12; i++)
		{
			cin >> a >> b;
			sum += (a - b);

			if(border <= sum && ok == false)
			{
				ok = true;
				ans = i;
			}
		}

		if(ok == true)
		{
			cout << ans << endl;
		}
		else
		{
			cout << "NA" << endl;
		}
	}
}