#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
ll c,T,n,k;
int main(){
	freopen("traverse.in" ,"r",stdin );
	freopen("traverse.out","w",stdout);
	srand(time(nullptr));
	scanf("%lld%lld",&c,&T);
	while(T--){
		scanf("%lld%lld",&n,&k);
		printf("%lld\n",rand()%mod);
	}
}
