#include<bits/stdc++.h>
#define rr register
#define maxn 2000005
#define TT 1000000007
using namespace std;
inline int read(){
	rr int num=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=-f;ch=getchar();}
	while(ch>='0'&&ch<='9') num=(num<<3)+(num<<1)+ch-'0',ch=getchar();
	return f*num;
}
queue<int >q[305];
int T,n,m,k;
int sum[1005],a[maxn];
inline int rd(){
	return ((rand()<<3)+(rand()<<1))%TT;
}
int main(){
	freopen("meow.in","r",stdin);
	freopen("meow.out","w",stdout);
	srand(time(0));
	T=read();
	while(T--){/*
		n=read(),m=read(),k=read();
		memset(sum,0,sizeof sum);
		for(rr int i=1;i<=n;i++) while(q[i].empty()) q[i].pop();
		for(rr int i=1;i<=m;i++) a[i]=read(),sum[a[i]]++;*/
		printf("%d\n",rd());
	}
	return 0;
}
