#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define maxn 1005

using namespace std;

struct nod{
	int nex,id;
	nod(int a,int b){nex=a;id=b;}
	nod(){}
};
int n,m,tim;
int vis[maxn];
int bel[maxn][maxn][2];
int u[maxn*maxn],v[maxn*maxn];
vector<nod>edge[maxn];

inline void dfs(int now,int fa,int b,int f)
{
	vis[now]=tim; bel[fa][now][f]=b;
	int len=edge[now].size();
	for(int i=0;i<len;i++)
		if(vis[edge[now][i].nex]!=tim)
			dfs(edge[now][i].nex,fa,b,f);
}

inline void solve(int now)
{
	tim++;vis[now]=tim;
	int len=edge[now].size();
	for(int i=0;i<len;i++)if(vis[edge[now][i].nex]!=tim)
		dfs(edge[now][i].nex,now,edge[now][i].id,0);
	reverse(edge[now].begin(),edge[now].end());
	tim++;vis[now]=tim;
	for(int i=0;i<len;i++)if(vis[edge[now][i].nex]!=tim)dfs(edge[now][i].nex,now,edge[now][i].id,1);
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%d%d",&u[i],&v[i]);
		edge[u[i]].push_back(nod(v[i],i));
	}
	for(int i=1;i<=n;i++)solve(i);
	for(int i=1;i<=m;i++)
	{
		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");
	}
}