#include<bits/stdc++.h>
#define re register
struct eg{int to;eg*nx;}e[200100],*la[1010],*cnt=e;
int ans[200100],fr[1010][1010],tg[1010][1010],sta[1010],ta,I;
inline void addE(re int a,re int b)
{
	*++cnt=(eg){b,la[a]};la[a]=cnt;
}
void dfs(re int a,re int*ff)
{
	for(re eg*i=la[a];i;i=i->nx)if(!ff[i->to])
	{
		ff[i->to]=ff[a];dfs(i->to,ff);
	}
}
int main()
{
	re int n,m,x,y;
	scanf("%d%d",&n,&m);
	for(re int i=1;i<=m;i++)scanf("%d%d",&x,&y),addE(x,y);
	for(I=1;I<=n;I++)
	{
		fr[I][I]=tg[I][I]=-1;
		for(re eg*i=la[I];i;i=i->nx)
		{
			sta[++ta]=i->to;if(!fr[I][i->to])
			{
				fr[I][i->to]=i->to;dfs(i->to,fr[I]);
			}
		}
		for(;ta;ta--)if(!tg[I][sta[ta]])
		{//printf("*t*%d %d\n",I,sta[ta]);
			tg[I][sta[ta]]=sta[ta];dfs(sta[ta],tg[I]);
		}
	}
	for(I=1;I<=n;I++)
	{
		for(re eg*i=la[I];i;i=i->nx)if(i->to==I)ans[i-e]=1;
		else{printf("**%d %d %d\n",I,i->to,tg[I][i->to]);
			ans[i-e]=(fr[I][i->to]==i->to&&tg[I][i->to]==i->to)==(fr[i->to][I]==0);
		}
	}
	for(re int i=1;i<=m;i++)puts(ans[i]?"same":"diff");
}