#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

ll l;
int main() {
  while (scanf("%lld", &l), l) {
    int ans = -1;
    ll sum = 0;
    REP(i, 12) {
      ll m, n;
      scanf("%lld %lld", &m, &n);
      sum += m - n;
      if (sum >= l && ans == -1) { ans = i; }
    }
    if (ans == -1) {
      puts("NA");
    } else {
      printf("%d\n", ans + 1);
    }
  }
}