#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count etc.
#include <cstdlib>	// require abs
#include <cstdio>	// require printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require sqrt ceil floor
#include <climits>	// require INT_MAX etc
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <stdint.h>	// require uint64_t
#include <fstream>	// require freopen

using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.nexttrip", "r", stdin );
	string str = "";
	while (getline (cin, str ) && str != "0" ){
		int l;
		stringstream ssl (str );
		ssl >> l;
		int sum = 0;
		int res = -1;
		bool found = false;
		for (int i = 0; i < 12; ++i ){
			int n, m;
			getline (cin, str );
			stringstream ss (str );
			ss >> n >> m;
			sum += (n - m );
			if (sum >= l && !found ){
				res = i+1;
				found = true;
			} // end if
		} // end for
		if (res != -1 ){
			cout << res << endl;
		}else{
			cout << "NA" << endl;
		} // end if
	} // end loop
		
	return 0;
}