#include <iostream>
#include <set>
#include <cstdio>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

using namespace std;

int main(){
  while(int l = getInt()){
    int sum = 0;
    int ans = 12;

    REP(i,12){
      int m = getInt();
      int n = getInt();

      sum += m - n;

      if(sum >= l)
	ans = min(ans, i);
    }

    if(ans == 12) puts("NA");
    else printf("%d\n", ans + 1);
  }
  return 0;
}