#include<bits/stdc++.h>
using namespace std;
const int N=1e3+7;
const int M=2e5+7;
inline int read(){
	int x=0; bool f=0; char ch=getchar();
	for(;!isdigit(ch);ch=getchar()) f=(ch=='-');
	for(;isdigit(ch);ch=getchar()) x=(x<<3)+(x<<1)+(ch^48);
	return f?-x:x;
}

int n,m;
int u[M],v[M],ans[M];
int head[N],to[M],nx[M],ec=1;
inline void add(int a,int b){
	nx[++ec]=head[a]; head[a]=ec; to[ec]=b;
}

int q[M],h,t;
vector<int>vec[N];
vector<int>pre[N];
inline void solve(int x){
	int hst=x;
	for(int i=1;i<=n;++i) pre[i].clear();
	h=1; t=0; pre[x].resize(2);
	for(int i=head[x];i;i=nx[i]){
		int v=to[i]; q[++t]=v;
		pre[v].push_back(i);
	}
	while(h<=t){
		x=q[h++];
		if(pre[x].size()==2){
			for(int i=head[x];i;i=nx[i]){
				int v=to[i];
				if(pre[v].size()==2) continue;
				if(pre[v].size()==1) pre[v].push_back(pre[x][pre[x][0]==pre[v][0]]);
				else pre[v]=pre[x]; q[++t]=v;
			}
		}
		else{
			for(int i=head[x];i;i=nx[i]){
				int v=to[i];
				if(pre[v].size()==2) continue;
				if(pre[v].size()==1&&pre[v][0]==pre[x][0]) continue;
				pre[v].push_back(pre[x][0]); q[++t]=v;
			}
		}
	}
	for(int i=0;i<vec[hst].size();++i){
		int id=vec[hst][i],x=u[id],y=v[id];
		if(hst==y&&pre[x].size()>0) ans[id]^=1;
		if(hst==x&&pre[y].size()>1) ans[id]^=1;
	}
}

int main(){
	n=read(); m=read();
	for(int i=1;i<=m;++i){
		u[i]=read(); v[i]=read(); add(u[i],v[i]);
		vec[u[i]].push_back(i); vec[v[i]].push_back(i);
	}
	for(int i=1;i<=n;++i) if(vec[i].size()) solve(i);
	for(int i=1;i<=m;++i) puts(ans[i]?"diff":"same");
	return 0;
}