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

const int MAXN = 1005;
const int MAXM = 200005;

vector<int> G[MAXN];

int D[MAXN][MAXN][2], Dn[MAXN][MAXN];

bitset<MAXN> C[MAXN];

int A[MAXM], B[MAXM];

int N, M;

void dfs(int i, bitset<MAXN> &chk) {
	chk[i] = true;
	for(int v : G[i]) if(!chk[v])
		dfs(v, chk);
}

void f(int i, int ri, int c) {
	if(2 == Dn[ri][i]) return;
	if(1 == Dn[ri][i] && D[ri][i][0] == c) return;
	D[ri][i][Dn[ri][i]++] = c;
	for(int v : G[i]) f(v, ri, c);
}

int main() {
	ios::sync_with_stdio(false);

	cin >> N >> M;
	for(int i = 1; i <= M; i++) {
		cin >> A[i] >> B[i];
		G[A[i]].eb(B[i]);
	}

	for(int i = 1; i <= N; i++) dfs(i, C[i]);
	for(int i = 1; i <= N; i++) {
		Dn[i][i] = 2;
		for(int v : G[i]) f(v, i, v);
	}

	for(int i = 1, a, b; i <= M; i++) {
		a = A[i]; b = B[i];

		bool flag = false;
		if(1 == Dn[a][b]) {
			if(b != D[a][b][0]) flag = true;
		} else if(2 == Dn[a][b]) {
			if(b != D[a][b][0]) flag = true;
			if(b != D[a][b][1]) flag = true;
		}

		puts((flag == C[b][a]) ? "same" : "diff");
	}
	return 0;
}