#include<cstdio>
#include<cstring>
#include<iostream>
#include<vector>
using namespace std; 
const int maxn=1000+50;
const int maxm=200000+50;
int N,M;
int p[maxn];
int q[maxn];
int c[maxn][maxn];
bool an[maxm];
struct edge
{
	int to,id;
	edge(int to=0,int id=0):to(to),id(id){}
};
vector<edge> adj[maxn];
void dfs(int u,int root)
{
	if(c[root][u]) return;
	c[root][u]=1;
	for(unsigned int i=0;i<adj[u].size();++i)
	{
		int v=adj[u][i].to;
		dfs(v,root); 
	}
}
void dfs(int u,int c,int *p)
{
	if(p[u]!=-1) return;
	p[u]=c;
	for(unsigned int i=0;i<adj[u].size();++i)
	{
		int v=adj[u][i].to;
		dfs(v,c,p);
	}
}
void solve()
{
	for(int i=1;i<=N;++i)
	{
		dfs(i,i);
	}
	for(int u=1;u<=N;++u)
	{
		memset(p,-1,sizeof(p));
		memset(q,-1,sizeof(q));
		int l=p[u]=q[u]=adj[u].size();
		for(int i=0;i<l;++i)
		{
			int v=adj[u][i].to;
			dfs(v,i,p);
		}
		for(int i=l-1;~i;--i)
		{
			int v=adj[u][i].to;
			dfs(v,i,q);
		}
		for(int i=0;i<l;++i)
		{
			int v=adj[u][i].to;
			int d=adj[u][i].id;
			an[d]=c[v][u]^(p[v]!=i||q[v]!=i);
		}
	}
}
int main()
{
	scanf("%d%d",&N,&M);
	for(int i=1;i<=M;++i)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		adj[a].push_back(edge(b,i));
	}
	solve();
	for(int i=1;i<=M;++i)
	{
		puts(an[i]?"diff":"same");
	}
	return 0;
}