#include<bits/stdc++.h>
#define re register
struct eg{int to;eg*nx;}e[400100],*la[1010],*la1[1010],*cnt=e,*cnt1;
int bl[1010],bl1[1010],num[1010],sta[1010],d[1010],ta,I,tot,tt,dfn[1010],low[1010];
int ans[200100],x[200100],y[200100];
bool in[1010],is[1010][1010],ia[1010];
inline void addE(re int a,re int b)
{
	*++cnt=(eg){b,la[a]};la[a]=cnt;
}
inline void addE1(re int a,re int b)
{
	*++cnt=(eg){b,la1[a]};la1[a]=cnt;
}
void dfs(re int a)
{
	low[a]=dfn[a]=++tot;
	in[a]=1;sta[++ta]=a;
	for(re eg*i=la[a];i;i=i->nx)if(i->to!=I)
	{
		if(!dfn[i->to])dfs(i->to),low[a]=std::min(low[a],low[i->to]);
		else if(in[i->to])low[a]=std::min(low[a],dfn[i->to]);
	}
	if(low[a]==dfn[a])
	{
		tt++;
		do
		{
			bl[sta[ta]]=tt;in[sta[ta]]=0;
		}while(sta[ta--]!=a);
	}
}
int main()
{
	re int n,m;
	scanf("%d%d",&n,&m);
	for(re int i=1;i<=m;i++)scanf("%d%d",&x[i],&y[i]),addE(x[i],y[i]);
	for(re int i=1;i<=n;i++)if(!dfn[i])dfs(i);
	for(re int i=1;i<=n;i++)bl1[i]=bl[i];
	for(I=1;I<=n;I++)
	{
		tt=tot=ta=0;cnt1=cnt;
		memset(dfn,0,sizeof(dfn));
		memset(la1,0,sizeof(la1));
		memset(num,0,sizeof(num));
		memset(ia,0,sizeof(ia));
		bl[I]=0;
		for(re int i=1;i<=n;i++)if((!dfn[i])&&i!=I)dfs(i);
		for(re eg*i=la[I];i;i=i->nx)if(!ia[i->to])(num[bl[i->to]]=(num[bl[i->to]])?2:1),ia[i->to]=1;
		for(re int i=1;i<=m;i++)if(bl[x[i]]!=bl[y[i]]&&bl[x[i]]&&bl[y[i]])
		{
			if(!is[bl[x[i]]][bl[y[i]]])
			addE1(bl[x[i]],bl[y[i]]),d[bl[y[i]]]++,is[bl[x[i]]][bl[y[i]]]=1;
		}
		for(re int i=1;i<=tt;i++)if(!d[i])sta[++ta]=i;
		for(re int i=1;i<=ta;i++)
		{
			re int x=sta[i];
			for(re eg*i1=la1[x];i1;i1=i1->nx)
			{
				if(!num[i1->to])num[i1->to]=num[x];
				else if(num[x])num[i1->to]=2;
				d[i1->to]--;
				if(!d[i1->to])sta[++ta]=i1->to;
			}
		}
		for(re int i=1;i<=m;i++)
		{
			is[bl[x[i]]][bl[y[i]]]=0;
		}
		for(re eg*i=la[I];i;i=i->nx)
		if(i->to!=I){
			ans[i-e]=(bl1[I]==bl1[i->to])==(num[bl[i->to]]>1);
		}else ans[i-e]=1;
		cnt=cnt1;
	}
	for(re int i=1;i<=m;i++)puts(ans[i]?"same":"diff");
}