//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<vector>
#define ll long long
#define inf 20021225
#define N 1010
#define M 200010 
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
vector<int> ed[N];
void add(int x,int y,int &id){id=ed[x].size(); ed[x].push_back(y);} 
int con[N][N],s,noc[N][N],n,m; bool vis[N][N]; bool ok[M];
void dfs(int *a,int x,int v)
{
	if(~a[x]||x==s)	return; a[x]=v; vis[s][x]=1;
	for(int i=0;i<ed[x].size();i++)	dfs(a,ed[x][i],v);
}
void solve()
{
	memset(con,-1,sizeof(con)); memset(noc,-1,sizeof(noc));
	for(int x=1;x<=n;x++)
		for(int i=0;i<ed[x].size();i++)
			s=x,dfs(con[x],ed[x][i],i);
	for(int x=1;x<=n;x++)
		for(int i=(int)ed[x].size()-1;~i;i--)
			s=x,dfs(noc[x],ed[x][i],i);
}
int u[M],v[M],id[M];
int main()
{
	n=read(),m=read();
	for(int i=1;i<=m;i++)
		u[i]=read(),v[i]=read(),add(u[i],v[i],id[i]);
	solve();
	for(int i=1;i<=m;i++)
	{
		if((vis[v[i]][u[i]])^((con[u[i]][v[i]]<id[i]&&~con[u[i]][v[i]])||noc[u[i]][v[i]]>id[i]))
			printf("diff\n");
		else
			printf("same\n");
	}
	return 0;
}