#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b;
  while(cin>>n,n){
    int q=12,o=1;
    while(q--){
      cin>>a>>b;
      n-=a-b;
      if(o&&n<=0){
        cout<<12-q<<endl;
        o--;
      }
    }
    if(o)cout<<"NA"<<endl;
  }
}