#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define all(x) x.begin(),x.end()
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
using namespace std;
typedef long long ll;
const int N=1005,M=N*N;
vector<int> g[N];
int n,m,ans[M],vis[N],clk;
int a[M],b[M],tim[N],del;
void dfs(int v){
	vis[v]=clk;
	for (int d:g[v]){
		if((!vis[d])&&d!=del)dfs(d);
	}
}
void gao(int x){
	del=x;
	mem(vis,0);
	clk=0;
	for(int d:g[x]){
		++clk;
		tim[d]=clk;
		if(!vis[d])dfs(d);
	}
	rep(i,1,m)if(a[i]==x&&vis[b[i]]!=tim[b[i]])ans[i]=1;

}
int main(int argc,char*argv[]){
	scanf("%d%d",&n,&m);
	rep(i,1,m){
		scanf("%d%d",a+i,b+i);
		g[a[i]].pb(b[i]);
	}
	rep(x,1,n){
		gao(x);
		reverse(all(g[x]));
		gao(x);
	}
	rep(x,1,n){
		del=0,clk=1;
		mem(vis,0);
		dfs(x);
		rep(i,1,m)if(b[i]==x)ans[i]^=vis[a[i]];
	}
	rep(i,1,m)printf("%s\n",ans[i]?"diff":"same");
	return 0;
}
