#include<bits/stdc++.h>
using namespace std;

#define CO const
#define IN inline
typedef long long int64;

template<class T> IN T read(){
	T x=0,w=1;char c=getchar();
	for(;!isdigit(c);c=getchar())if(c=='-') w=-w;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*w;
}
template<class T> IN T read(T&x){
	return x=read<T>();
}

CO int N=1e3+10,M=2e5+10;
struct edge {int v,id;};
vector<edge> to[N];
pair<int,int> E[M];
int f[N][N][2],vis[N],T;

void dfs(int u,int src,int id,int type){
	f[src][u][type]=id,vis[u]=T;
	for(CO edge&e:to[u])if(vis[e.v]!=T)
		dfs(e.v,src,id,type);
}
void work(int src){
	++T,vis[src]=T;
	for(CO edge&e:to[src])if(vis[e.v]!=T) // edit 1: vis check
		dfs(e.v,src,e.id,0);
	reverse(to[src].begin(),to[src].end());
	++T,vis[src]=T;
	for(CO edge&e:to[src])if(vis[e.v]!=T)
		dfs(e.v,src,e.id,1);
}
int main(){
	int n=read<int>(),m=read<int>();
	for(int i=1;i<=m;++i){
		int u=read<int>(),v=read<int>();
		to[u].push_back({v,i});
		E[i]={u,v};
	}
	for(int i=1;i<=n;++i) work(i);
	for(int i=1;i<=m;++i){
		int u=E[i].first,v=E[i].second;
		puts((f[v][u][0]!=0)^(f[u][v][0]!=i or f[u][v][1]!=i)?"diff":"same");
	}
	return 0;
}
