#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<queue>
#include<bitset>
#include<complex>
#include<cmath>
using namespace std;
template<typename __T>
inline void read(__T &x)
{
    x=0;
    int f=1;char c=getchar();
    while(!isdigit(c)){if(c=='-')	f=-1;c=getchar();}
    while(isdigit(c))	{x=x*10+c-'0';c=getchar();}
    x*=f;
}
typedef pair<int,int> pi;
int n,m;
vector<pi>ed[1005];
int u[200005],v[200005];
int bel[1005][1005][2];
bool vis[1005];
void dfs(int now,int fa,int belid,int typ)
{//cout<<"GG"<<now<<' '<<fa<<' '<<belid<<' '<<typ<<endl;
	bel[fa][now][typ]=belid;
	vis[now]=1;
	for(int i=0;i<ed[now].size();i++)
		if(!vis[ed[now][i].first])
			dfs(ed[now][i].first,fa,belid,typ);
}
int main()
{
	read(n);
	read(m);
	for(int i=1;i<=m;i++)
	{
		read(u[i]);
		read(v[i]);
		ed[u[i]].push_back(make_pair(v[i],i));
	}
	for(int i=1;i<=n;i++)
	{//cout<<"WORK"<<i<<endl;
		memset(vis,0,sizeof(vis));
		vis[i]=1;
		for(int j=0;j<ed[i].size();j++)
			if(!vis[ed[i][j].first])
				dfs(ed[i][j].first,i,ed[i][j].second,0);
		reverse(ed[i].begin(),ed[i].end());
		memset(vis,0,sizeof(vis));
		vis[i]=1;
		for(int j=0;j<ed[i].size();j++)
			if(!vis[ed[i][j].first])
				dfs(ed[i][j].first,i,ed[i][j].second,1);
	}
	for(int i=1;i<=m;i++)
	{//cout<<"A"<<u[i]<<' '<<v[i]<<' '<<bel[v[i]][u[i]][0]<<' '<<bel[u[i]][v[i]][0]<<' '<<bel[u[i]][v[i]][1]<<endl;
		if(bel[v[i]][u[i]][0]!=0 ^ (bel[u[i]][v[i]][0]!=i || bel[u[i]][v[i]][1]!=i))
			printf("diff\n");
		else
			printf("same\n");
	}
	return 0;
}