#include <bits/stdc++.h>
using namespace std;
 
const int N = 1e3 + 5;
const int M = 5e5 + 5;
 
int fir[N] , ne[M] , to[M] , cnt , x , y , scc[N] , scc_tot , dfs_clock , dfn[N] , low[N] , Id[M] , n , m;
int A[M] , B[M];
int stk[N] , top;
int ans[M];
int L[N][N], R[N][N];

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

bool can[N][N];

queue <int> q;

vector <int> son[N];

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

void solve(int x) {
	while(!q.empty()) q.pop();
	q.push(x);
	while(!q.empty()) {
		int ind = q.front();
		can[x][ind] = 1;
		q.pop();
		Foreachson(i, ind) {
			int V = to[i];
			if(can[x][V]) continue;
			q.push(V);
			can[x][V] = 1;
		}
	}
	
	Foreachson(i, x) {
		int V = to[i];
		while(!q.empty()) q.pop();
		if(!L[x][V]) {
			q.push(V);
			L[x][V] = V;
		}
		while(!q.empty()) {
			int ind = q.front();
			q.pop();
			Foreachson(j, ind) {
				int v = to[j];
				if(!L[x][v] && v != x) {
					L[x][v] = V;
					q.push(v);
				}
			}
		}
	}
	
	for(int i = 0; i < (int) son[x].size(); ++ i) {
		int V = son[x][i];
		while(!q.empty()) q.pop();
		if(!R[x][V]) {
			q.push(V);
			R[x][V] = V;
		}
		while(!q.empty()) {
			int ind = q.front();
			q.pop();
			for(int j = 0; j < (int) son[ind].size(); ++ j) {
				int v = son[ind][j];
				if(!R[x][v] && v != x) {
					R[x][v] = V;
					q.push(v);
				}
			}
		}
	}
}

 
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);
	}
	
	for(int i = 1; i <= n; ++ i) {
		Foreachson(j, i) {
			int V = to[j];
			son[i].push_back(V);
		}
		reverse(son[i].begin(), son[i].end());
	}
	
	for(int i = 1; i <= n; ++ i) {
		solve(i);
	}
	
	for(int i = 1; i <= m; ++ i) {
		if(L[A[i]][B[i]] != B[i] || R[A[i]][B[i]] != B[i]) {
			if(!can[B[i]][A[i]]) puts("diff");
			else puts("same");
		}
		else {
			if(can[B[i]][A[i]]) puts("diff");
			else puts("same");
		}
	}
}
