#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x); i<=(y); i++)
#define per(i,x,y) for (int i=(x); i>=(y); i--)
#define ll long long
#define N 1005
#define M 200005
using namespace std;
ll read(){
	char ch=getchar(); ll x=0; int op=1;
	for (; !isdigit(ch); ch=getchar()) if (ch=='-') op=-1;
	for (; isdigit(ch); ch=getchar()) x=(x<<1)+(x<<3)+ch-'0';
	return x*op;
}
int n,m,a[N][N],x[M],y[M],vis[N];
vector<int> e[N];
void dfs(int st,int u,int now){
	if (st==u) return;
	if (a[st][u]>=2) return;
	if (a[st][u]==1 && vis[u]==now) return;
	if (a[st][u]==0) vis[u]=now;
	a[st][u]++;
	rep (i,0,(int)e[u].size()-1) dfs(st,e[u][i],now);
}
int main(){
	n=read(); m=read();
	rep (i,1,m){
		x[i]=read(),y[i]=read();
		e[x[i]].push_back(y[i]);
		
	}
	rep (i,1,n){
		memset(vis,-1,sizeof(vis));
		rep (j,0,(int)e[i].size()-1) dfs(i,e[i][j],e[i][j]);
	}
	rep (i,1,m){
		bool f1=a[y[i]][x[i]]>=1;
		bool f2=a[x[i]][y[i]]>=2;
		if (f1==f2) puts("same"); else puts("diff");
	}
	return 0;
}