#include <iostream>
using namespace std;

int main(){
	int l, m[14], n[14], ans;
	while(cin>>l, l){
		for(int i=1; i<=12; i++)cin>>m[i]>>n[i];
		for(ans=1; ans<=13; ans++){			
			if(m[ans]-n[ans]>0)l-=m[ans]-n[ans];
			if(l<=0)break;
		}
		ans!=13 ? cout<<ans<<endl : cout<<"NA\n";
	}
	return 0;
}