#include <bits/stdc++.h>
using namespace std;

const int N = 1e3 + 5;
const int M = 5e5 + 5;

int fir[M] , ne[M] , to[M] , cnt , x , y , scc[M] , scc_tot , dfs_clock , dfn[M] , low[M] , Id[M] , n , m;
int A[M] , B[M];
int stk[M] , top;

vector <int> G[N];
vector <int> who[N];

void add(int x , int y , int id) {
	ne[++ cnt] = fir[x]; fir[x] = cnt; to[cnt] = y; Id[cnt] = id;
}

#define Foreachson(i , x) for(int i = fir[x];i;i = ne[i])

void dfs(int x) {
	int cur = top;
	dfn[x] = low[x] = ++ dfs_clock; stk[++ top] = x;
	Foreachson(i , x) {
		int V = to[i];
		if(!dfn[V]) {
			dfs(V);
			low[x] = min(low[x] , low[V]);
		}
		else if(!scc[V]) low[x] = min(low[x] , low[V]);
	}
	if(dfn[x] == low[x]) {
		++ scc_tot;
		while(top > cur) {
			who[scc_tot].push_back(stk[top]);
			scc[stk[top]] = scc_tot;
			-- top;
			if(stk[top + 1] == x) break;
		}
	}
}

bool vis[N];

int dp[N][N] , rd[N] , cd[N];

void solve(int x) {
	if(vis[x]) 
	return;
	vis[x] = 1;
	for(int i = 0;i < (int) G[x].size();++ i) {
		int V = G[x][i];
		solve(V);
		for(register int j = 1;j <= scc_tot;++ j) dp[x][j] += dp[V][j];
	}
	++ dp[x][x];
	for(int i = 1;i <= scc_tot;++ i) dp[x][i] = min(dp[x][i] , 20);
}

int ans[M];

main(void) {
	scanf("%d%d" , &n , &m);
	for(int i = 1;i <= m;++ i) {
		scanf("%d%d" , &x , &y);
		A[i] = x , B[i] = y;
		add(x , y , i);
	}
	for(int i = 1;i <= n;++ i) if(!dfn[i]) dfs(i);
	for(int x = 1;x <= n;++ x) {
		Foreachson(i , x) {
			int V = to[i];
			if(scc[V] == scc[x]) {
				++ rd[V]; ++ cd[x];
			}
			else
			G[scc[x]].push_back(scc[V]);
		}
	}
	for(int i = 1;i <= scc_tot;++ i) {
		if(!vis[i]) solve(i);
	}
	for(int i = 1;i <= m;++ i) {
		int x = A[i] , V = B[i];
		if(scc[x] == scc[V]) {
			int a = cd[x] - 1 , b = rd[V] - 1;
			if(!a || !b) ans[i] = 1;
			else ans[i] = 0;
		}
		else {
			if(dp[scc[x]][scc[V]] >= 2) ans[i] = 1;
			else ans[i] = 0;
		}
	}
	for(int i = 1;i <= m;++ i) if(ans[i]) puts("diff"); else puts("same");
}