#include <bits/stdc++.h>
using namespace std;
#define ri register int
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	// input a signed integer
	template <class I>
	inline void gi (I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = (x << 1) + (x << 3) + (c & 15); x *= f;
	}
	// input a letter
	template <class I>
	inline void get (I &x) {
		for (c = gc(); c < 'A' || c > 'Z'; c = gc()) ;
		x = c;
	}
	// input a string
	inline void read (char *s){
		for(c = gc(); c < 'A' || c > 'Z'; c = gc()) ;
		for(; c >= 'A' && c <= 'Z'; c = gc()) *++s = c;
		*++s = '\0';
	}
	// print a signed integer
	template <class I>
	inline void print (I x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: gi;
using io :: get;
using io :: read;
using io :: putc;
using io :: print;
const int N=1e3+5,M=2e5+5;
int f[N][N],g[M],tot,head[N],nxt[M],adj[M],e[N][N],a[M],b[M],tot2,head2[N],nxt2[M],adj2[M],
	vis[N],sta[2][N];
inline void addedge(ri x,ri y){
	nxt[++tot]=head[x];
	adj[head[x]=tot]=y;
}
inline void addedge2(ri x,ri y){
	nxt2[++tot2]=head2[x];
	adj2[head2[x]=tot2]=y;
}
inline void dfs0(ri x,ri rt){
	f[rt][x]=1;
	for(ri i=head[x];i;i=nxt[i])
		if(!f[rt][adj[i]])
			dfs0(adj[i],rt);
}
int cur;
inline void dfs(ri x,ri rt){
	if(vis[x]==cur) return;
	vis[x]=cur;
	sta[cur][x]=rt;
	for(ri i=head[x];i;i=nxt[i])
		dfs(adj[i],rt);
}
int main(){
	ri n,m,i,x;
	gi(n);gi(m);
	for(i=1;i<=m;++i)
		gi(a[i]),gi(b[i]),
		++e[a[i]][b[i]],
		addedge(a[i],b[i]);
	for(i=m;i;--i)
		addedge2(a[i],b[i]);
	for(i=1;i<=n;++i)
		dfs0(i,i);
	for(x=1;x<=n;++x){
		cur^=1;
		vis[x]=cur;
		for(i=head[x];i;i=nxt[i])
			dfs(adj[i],i);
		cur^=1;
		vis[x]=cur;
		for(i=head2[x];i;i=nxt2[i])
			dfs(adj2[i],m-i+1);
		for(i=head[x];i;i=nxt[i])
			g[i]=sta[0][adj[i]]!=sta[1][adj[i]];
	}
	for(i=1;i<=m;++i)
		puts(f[b[i]][a[i]]^g[i]?"diff":"same");
	return 0;
}