#include<bits/stdc++.h>
#define re register
std::vector<int>to[1010],t[1010];
int ans[200100],fr[1010][1010],tg[1010][1010],I;
void dfs(re int a,re int*ff)
{
	for(re int i=0;i<to[a].size();i++)if(!ff[to[a][i]])
	{
		ff[to[a][i]]=ff[a];dfs(to[a][i],ff);
	}
}
int main()
{
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	re int n,m,x,y;
	scanf("%d%d",&n,&m);
	for(re int i=1;i<=m;i++)scanf("%d%d",&x,&y),to[x].push_back(y),t[x].push_back(i);
	for(I=1;I<=n;I++)
	{
		fr[I][I]=tg[I][I]=-1;
		for(re int i=0;i<to[I].size();i++)if(!fr[I][to[I][i]])
		{
			fr[I][to[I][i]]=to[I][i];dfs(to[I][i],fr[I]);
		}
		for(re int i=to[I].size()-1;i>=0;i--)if(!tg[I][to[I][i]])
		{
			tg[I][to[I][i]]=to[I][i];dfs(to[I][i],tg[I]);
		}
	}
	for(I=1;I<=n;I++)
	{
		for(re int i=0;i<to[I].size();i++)if(to[I][i]==I)ans[t[I][i]]=1;
		else{//printf("**%d %d %d\n",I,i->to,tg[I][i->to]);
			ans[t[I][i]]=(fr[I][to[I][i]]==to[I][i]&&tg[I][to[I][i]]==to[I][i])==(fr[to[I][i]][I]==0);
		}
	}
	for(re int i=1;i<=m;i++)puts(ans[i]?"same":"diff");
}