#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
std::mt19937 rnd(time(NULL));
#define rand rnd
#define pr std::pair<int,int>
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
template<class T>void cxk(T&a,T b){a=a>b?a:b;}
template<class T>void cnk(T&a,T b){a=a<b?a:b;}
#ifdef mod
int pow(int x,int y){
	int ret=1;
	while(y){
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod;y>>=1;
	}
	return ret;
}
template<class Ta,class Tb>void inc(Ta&a,Tb b){a=a+b>=mod?a+b-mod:a+b;}
template<class Ta,class Tb>void dec(Ta&a,Tb b){a=a>=b?a-b:a+mod-b;}
#endif
int fir[1010],ex[200010],ey[200010];
std::vector<int>G[1010];
int vis[1010][1010],que[1010],hd,tl,from[1010];
bool vv[1010];
int main(){
#ifdef LOCAL
	freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
#endif
	int n=gi(),m=gi(),x,y;
	for(int i=1;i<=m;++i)ex[i]=x=gi(),ey[i]=y=gi(),G[x].push_back(y);
	for(int s=1;s<=n;++s){
		int*v=vis[s];
		v[s]=1;hd=tl=0,que[tl++]=s;from[s]=0;
		while(hd^tl){
			int x=que[hd++];
			for(int i:G[x])
				if(!v[i])v[i]=1,from[i]=(x==s?i:from[x]),que[tl++]=i;
				else if(from[x]!=from[i])from[i]=-1;
		}
		hd=tl=0,que[tl++]=s;
		memset(vv,0,sizeof vv);vv[s]=1;
		while(hd^tl){
			int x=que[hd++];
			for(int i:G[x]){
				if(!vv[i])vv[i]=1,que[tl++]=i;
				if(x!=s&&i!=from[x])++v[i];
				if(x!=s&&from[x]!=from[i])from[i]=-1;
			}
		}
	}
	for(int i=1;i<=m;++i){
		x=ex[i],y=ey[i];
		if(vis[y][x])puts(vis[x][y]==1?"diff":"same");
		else puts(vis[x][y]==1?"same":"diff");
	}
	return 0;
}
