#include <bits/stdc++.h>
using namespace std;
const int MAXN=1007;
struct nod
{
	int to,id;
	nod(int a,int b)
	{
		to=a;
		id=b;
	}
	nod(){}
};
int n,m,tim;
int vis[MAXN],can[MAXN][MAXN][2];
int u[MAXN*MAXN],v[MAXN*MAXN];
vector<nod> edge[MAXN];
void dfs(int now,int fa,int b,int f)
{
	vis[now]=tim; can[fa][now][f]=b;
	for(int i=0;i<edge[now].size();i++){
		int v=edge[now][i].to;
		if(vis[v]!=tim) dfs(v,fa,b,f);
	}
}
inline void solve(int now)
{
	tim++; vis[now]=tim;
	for(int i=0;i<edge[now].size();i++){
		int v=edge[now][i].to;
		if(vis[v]!=tim) dfs(edge[now][i].to,now,edge[now][i].id,0);
	}
	reverse(edge[now].begin(),edge[now].end());
	tim++; vis[now]=tim;
	for(int i=0;i<edge[now].size();i++){
		if(vis[edge[now][i].to]!=tim) dfs(edge[now][i].to,now,edge[now][i].id,1);
	}
}
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>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((can[v[i]][u[i]][0]!=0)^0^(can[u[i]][v[i]][0]!=i||can[u[i]][v[i]][1]!=i))
			cout<<("diff\n");
		else cout<<("same\n");
	}
}