#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=1005,M=200005;
int n,m;
vector <int> o[N];
int Map[N][N];
struct Edge{
	int x,y,res;
}e[M];
int cnt[N],vis[N],Tg=0;
void dfs(int x){
	cnt[x]++;
	vis[x]=Tg;
	for (auto i : o[x])
		if (vis[e[i].y]!=Tg&&cnt[e[i].y]<2)
			dfs(e[i].y);
}
int main(){
	n=read(),m=read();
	For(i,1,m){
		e[i].x=read(),e[i].y=read();
		o[e[i].x].pb(i);
		Map[e[i].x][e[i].y]=i;
	}
	For(i,1,n){
		clr(cnt);
		cnt[i]=2;
		for (auto j : o[i]){
			Tg=j;
			if (cnt[e[j].y]<2)
				dfs(e[j].y);
		}
		for (auto j : o[i])
			e[j].res^=cnt[e[j].y]==2;
		For(j,1,n)
			if (Map[j][i]){
				int k=Map[j][i];
				e[k].res^=cnt[j]>0;
			}
	}
	For(i,1,m)
		puts(!e[i].res?"same":"diff");
	return 0;
}