#include<cstdio>
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
const int N=1010,M=2e5+10;
int w[M],ne[M],la[N],t,ans[M];
void link(int x,int y){
	w[++t]=y;
	ne[t]=la[x];
	la[x]=t;
}
int arv[N][N],n,m,X,mrk[N],ti,mrk2[N];
vector<int> e[N];
//void dfs(int x){
//	arv[X][x]=1;
//	for (int y=la[x];y;y=ne[y])
//		if (!arv[X][w[y]])dfs(w[y]);
//}
void go(int x){
	mrk[x]=ti;
	for (auto z:e[x])
		if (z!=X&&!mrk[z])go(z);
}
void go2(int x){
	mrk2[x]=ti;
	for (auto z:e[x])
		if (z!=X&&!mrk2[z])go2(z);
}
vector<int> c;
int main(){
	cin>>n>>m;
	for (int i=1;i<=m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		link(x,y);
		e[x].push_back(y);
	}
	for (X=1;X<=n;X++){
		c.clear();
		for (int y=la[X];y;y=ne[y]){
			ti++;
			if (!mrk[w[y]])go(w[y]);
			c.push_back(w[y]);
		}
		while (c.size()){
			if (!mrk2[c.back()])go2(c.back());
			c.pop_back();
			ti--;
		}
		for (int y=la[X];y;y=ne[y])ans[y]=(mrk[w[y]]<mrk2[w[y]]);
		for (int i=1;i<=n;i++)arv[X][i]=(bool)mrk[i],mrk[i]=mrk2[i]=0;
	}
	for (int x=1;x<=n;x++)
		for(int y=la[x];y;y=ne[y])
			ans[y]=ans[y]==arv[w[y]][x];
	for (int i=1;i<=m;i++)
		puts(ans[i]?"same":"diff");
}