#include <bits/stdc++.h>
using namespace std;

const int N = 400010;
int h[N],e[N],ne[N],idx,hh[N],ee[N],nne[N],idxx;
void add(int a,int b)
{
	e[idx]=b,ne[idx]=h[a],h[a]=idx++;
}
bool vis[N];
vector<int> v[200010];
int n,k,ans;
void dfs(int x,int c)
{
	if(c==n-1)
	{
		ans++;
		return;
	}
	for(int i=h[x];i!=-1;i=ne[i])
	{
		if(!vis[e[i]])
		{
			vis[e[i]]=1;
			dfs(e[i],c+1);
			vis[e[i]]=0;
		}
	}
}
int main()
{
	freopen("traverse.in","r",stdin);
	freopen("traverse.out","w",stdout);
	int c,t;
	scanf("%d%d",&c,&t);
	while(t--)
	{
		scanf("%d%d",&n,&k);
		if(c==18) printf("%d\n",1);
		else printf("%d\n",k);
		ans=0;
		for(int i=1;i<=n;i++) v[i].clear();
	}
	return 0;
}
/*
1 1
4 1
1 2
2 3
2 4
1

*/
