#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

int n,m,x[200005],y[200005];
vector<pair<int,int> > v[1005];
bool vis[1005],ff[1005][1005];
int f[2005],g[2005];
bool ans[200005];
void dfs(int x)
{
	vis[x]=true;
	for (int i=0;i<v[x].size();++i)
	{
		int y=v[x][i].second;
		if (vis[y]) continue;
		dfs(y);
	}
}
void dfs2(int x,int id)
{
	if (f[x]!=-1) return;
	f[x]=id;
	for (int i=0;i<v[x].size();++i)
	{
		int y=v[x][i].second;
		if (f[y]!=-1) continue;
		dfs2(y,id);
	}
}
void dfs3(int x,int id)
{
	if (g[x]!=-1) return;
	g[x]=id;
	for (int i=0;i<v[x].size();++i)
	{
		int y=v[x][i].second;
		if (g[y]!=-1) continue;
		dfs3(y,id);
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;++i)
	{
		scanf("%d%d",&x[i],&y[i]);
		v[x[i]].push_back(make_pair(i,y[i]));
	}
	for (int i=1;i<=n;++i) sort(v[i].begin(),v[i].end());
	memset(ff,false,sizeof(ff));
	for (int i=1;i<=n;++i)
	{
		for (int j=1;j<=n;++j) vis[j]=false;
		dfs(i);
		for (int j=1;j<=n;++j) ff[i][j]=vis[j];
	}
	for (int i=1;i<=n;++i)
	{
		for (int j=1;j<=n;++j) f[j]=g[j]=-1;
		vis[i]=true;
		f[i]=g[i]=0;
		for (int j=0;j<v[i].size();++j)
		{
			int x=i,y=v[i][j].second,id=v[i][j].first;
			dfs2(y,id);
		}
		for (int j=(int)v[i].size()-1;j>=0;--j)
		{
			int x=i,y=v[i][j].second,id=v[i][j].first;
			dfs3(y,id);
		}
		for (int j=0;j<v[i].size();++j)
		{
			int y=v[i][j].second,id=v[i][j].first;
			if (f[y]==id&&g[y]==id) ans[id]=false;
			else ans[id]=true;
		}
	}
	for (int i=1;i<=m;++i)
	{
		if (ans[i]==ff[y[i]][x[i]]) printf("same\n");
		else printf("diff\n");
	}
	return 0;
}