#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> P;

int main() {
    while (true) {
        int l;
        cin >> l;
        if (l == 0) break;

        bool ok = true;
        rep(i, 12) {
            int m, n;
            cin >> m >> n;
            if (m-n >= l) {
                if (ok) cout << i+1 << endl;
                ok = false;
            } else l -= m-n;
        }
        if (ok) cout << "NA" << endl;
    }

    return 0;
}
