#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 1020, M = 203000, inf = 0x3f3f3f3f;
int n,m,head[N],nxt[M],to[M],edgenum,a[M],b[M],d[N],mx[N],q[N<<2],res[M];Vi e[N];
void add(int u, int v){
	to[++edgenum]=v;nxt[edgenum]=head[u];head[u]=edgenum;
}
inline void dfs(int u, int *d){
	L(i,u)if(d[to[i]]==inf)d[to[i]]=d[u],dfs(to[i],d);
}
int main() {
	read(n);read(m);rep(i,1,m)read(a[i]),read(b[i]),add(a[i],b[i]),e[b[i]].pb(i);
	rep(u,1,n){
		int f=1,r=1;
		memset(d,inf,sizeof(d));memset(mx,inf,sizeof(mx));
		L(i,u)q[r++]=to[i];d[u]=mx[u]=0;
		/*while(f!=r){
			int u=q[f++];
			L(i,u)if(d[to[i]]>d[u]||mx[to[i]]<mx[u])
				mx[to[i]]=mx[u],d[to[i]]=d[u],q[r++]=to[i];
		}*/
		static int s[N];int len=0;L(i,u)s[++len]=to[i];
		rep(i,1,len)if(d[s[i]]==inf)d[s[i]]=s[i],dfs(s[i],d);
		per(i,len,1)if(mx[s[i]]==inf)mx[s[i]]=s[i],dfs(s[i],mx);
		L(i,u)res[i]^=d[to[i]]!=to[i]||mx[to[i]]!=to[i];
		per(i,SZ(e[u])-1,0)res[e[u][i]]^=d[a[e[u][i]]]<inf;
	}
	rep(i,1,m)printf("%s\n",res[i]?"diff":"same");
	return 0;
}
