#include<bits/stdc++.h>
#define re register
#define inc(i,j,k) for(re int i=j;i<=k;i++)
#define edge(u) for(re int i=head[u];i;i=e[i].nxt)
#define mp make_pair
#define fi first
#define se second
using namespace std;
const int N=1e3+5;
const int M=2e5+5;
inline int read(){
	int x=0;
	char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	while('0'<=ch&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x;
}
bool vis[N],vis1[N][N],vis2[N][N];
int n,m,head[N],cnt,a[M],b[M],mark[N];
struct edge{
	int to,nxt;
}e[M];
void add(int a,int b){
	e[++cnt].to=b;
	e[cnt].nxt=head[a];
	head[a]=cnt;
}
void dfs1(int u,int s){
	vis1[s][u]=1;
	edge(u){
		int v=e[i].to;
		if(!vis1[s][v]) dfs1(v,s);
	}
}
void dfs2(int u,int s,int tp,int c){
	if(!tp) mark[u]=c;
	else vis2[s][u]=c!=mark[u];
	vis[u]=1;
	edge(u){
		int v=e[i].to;
		if(vis[v]) continue;
		dfs2(v,s,tp,c);
	}
}
vector<pair<int,int> > ve;
int main(){
	n=read(),m=read();
	inc(i,1,m){
		a[i]=read(),b[i]=read();
		add(a[i],b[i]);
	}
	inc(i,1,n) dfs1(i,i);
	inc(u,1,n){
		memset(vis,0,sizeof(vis));vis[u]=1;
		edge(u){
			int v=e[i].to;
			ve.push_back(mp(v,i));
			if(vis[v]) continue;
			dfs2(v,u,0,i);
		}
		memset(vis,0,sizeof(vis));vis[u]=1;
		for(re int i=ve.size()-1;i>=0;i--){
			int v=ve[i].fi,c=ve[i].se;
			if(vis[v]) continue;
			dfs2(v,u,1,c);
		}
		ve.clear();
	}
	inc(i,1,m) puts(vis1[b[i]][a[i]]^vis2[a[i]][b[i]]?"diff":"same");
}