#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    int a,b,i;
	int m[12];
	rep(i,12){
	  cin>>a>>b;
	  m[i]=a-b;
	}
	int sum=0;
	rep(i,12){
	  sum+=m[i];
	  if(n<sum)break;
	}
	if(i==12)cout<<"NA"<<endl;
	else cout<<i+1<<endl;
  }
}