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

bool bo[1010];
int n,m,mi[1010],ma[1010],bel[1010],sta[1010],tp,dfn[1010],low[1010],x,y,cnt,t[1010],tn,q[1010],l,r,ans[200010];
vector<int> v[1010],p[1010];

void tarjan(int x)
{
	dfn[x]=low[x]=(++cnt),sta[++tp]=x,bo[x]=1;
	for (int i=0,sz=v[x].size(); i<sz; i++)
		if (!dfn[v[x][i]]) tarjan(v[x][i]),low[x]=min(low[x],low[v[x][i]]);
		else if (bo[v[x][i]]) low[x]=min(low[x],dfn[v[x][i]]);
	if (dfn[x]==low[x])
	{
		bel[x]=x;
		while (sta[tp]!=x) bel[sta[tp]]=x,bo[sta[tp]]=0,tp--;
		tp--,bo[x]=0;
	}
}

int main()
{
	scanf("%d%d",&n,&m),cnt=0;
	for (int i=1; i<=m; i++) scanf("%d%d",&x,&y),v[x].push_back(y),p[x].push_back(i);
	memset(bo,0,sizeof(bo)),tp=cnt=0;
	for (int i=1; i<=n; i++) if (!dfn[i]) tarjan(i);
	for (int i=1; i<=n; i++)
	{
		tn=0;
		for (int j=0,sz=v[i].size(); j<sz; j++) t[++tn]=v[i][j];
		for (int j=1; j<=n; j++) mi[j]=ma[j]=-1;
		mi[i]=ma[i]=0;
		for (int j=1; j<=tn; j++) if (mi[t[j]]==-1)
		{
			q[l=r=1]=t[j],mi[t[j]]=j;
			while (l<=r)
			{
				x=q[l++];
				for (int k=0,sz=v[x].size(); k<sz; k++)
					if (mi[v[x][k]]==-1) mi[q[++r]=v[x][k]]=j;
			}
		}
		for (int j=tn; j; j--) if (ma[t[j]]==-1)
		{
			q[l=r=1]=t[j],ma[t[j]]=j;
			while (l<=r)
			{
				x=q[l++];
				for (int k=0,sz=v[x].size(); k<sz; k++)
					if (ma[v[x][k]]==-1) ma[q[++r]=v[x][k]]=j;
			}
		}
		for (int j=0,sz=v[i].size(); j<sz; j++)
			ans[p[i][j]]=((mi[v[i][j]]!=ma[v[i][j]])^(bel[i]==bel[v[i][j]]));
	}
	for (int j=1; j<=m; j++) puts(ans[j]?"diff":"same");
	return 0;
}