#include <cstdio>

int main(void) {
	while(true) {
		int n;
		scanf("%d", &n);
		if(n == 0)
			break;

		int ans = 0;
		for(int i = 1; i <= 12; i++) {
			int p, q;
			scanf("%d %d", &p, &q);
			n -= p - q;
			if(ans == 0 && n < 0)
				ans = i;
		}
		if(ans != 0)
			printf("%d\n", ans);
		else
			printf("NA\n");
	}
	return 0;
}