#include <bits/stdc++.h>
using namespace std;
#define N 1010
#define M 200010
vector <int> G[N];
int to[M],tag[N],q[2*N];
bool ans1[M],ans2[M];
int read(){
	int x=0,f=1;
	char ch=getchar();
	while (ch<'0' || ch>'9'){
		if (ch=='-') f=-1;
		ch=getchar();
	}
	while (ch>='0' && ch<='9'){
		x=x*10+ch-'0';ch=getchar();
	}
	return x*f;
}
signed main(){
	int n=read(),m=read();
	for (int i=1;i<=m;++i){
		int x=read();to[i]=read();
		G[x].push_back(i);
	}
	for (int i=1;i<=n;++i){
		for (int j=1;j<=n;++j) tag[j]=0;
		int t=1,w=0;
		for (auto &x:G[i]){
			q[++w]=to[x];tag[to[x]]=x;
		}
		while (t<=w){
			int x=q[t++],y=tag[x];
			for (auto &p:G[x]){
				int tmp=to[p];
				if (tmp!=i){
					if (tag[tmp]!=-1){
						if (tag[tmp]==0){
							q[++w]=tmp;tag[tmp]=y;
						}else if (tag[tmp]!=y){
							q[++w]=tmp;tag[tmp]=-1;
						}
					}
				}else ans1[p]=1;
			}
		}
		for (auto &x:G[i]){
			if (tag[to[x]]==-1) ans2[x]=1;
		}
	}
	for (int i=1;i<=m;++i) puts(ans1[i]^ans2[i]?"diff":"same");
	return 0; 
}