#include <bits/stdc++.h>
#define for_bitset(variable, bitset) for (variable = bitset._Find_first(); variable != N; variable = bitset._Find_next(variable))

const int N = 1054, M = 200054;
typedef std::bitset <N> bitset;

int V, E, tag, root;
int from[N], _u[M], _v[M];
bitset G[N], single[N];
bitset saturated, connected[N], reversible[N];

void dfs(int x) {
	from[x] ? saturated.set(x) : (from[x] = tag, single[tag].set(x));
	bitset remain = G[x] & ~saturated & ~single[tag];
	int y; for_bitset(y, remain) dfs(y);
}

void solve() {
	int i;
	memset(from, 0, (V + 1) << 2);
	saturated.reset(), saturated.set(root);
	for_bitset(tag, G[root]) if (!saturated.test(tag)) dfs(tag);
	connected[root] = reversible[root] = saturated;
	for (i = 1; i <= V; ++i)
		connected[root].set(i, connected[root].test(i) || from[i]),
		reversible[root].set(i, reversible[root].test(i) || (from[i] && from[i] != i));
	for (i = 1; i <= V; ++i) single[from[i]].reset(i);
}

int main() {
	int i, u, v;
	scanf("%d%d", &V, &E);
	for (i = 1; i <= E; ++i) scanf("%d%d", &u, &v), G[u].set(v), _u[i] = u, _v[i] = v;
	for (root = 1; root <= V; ++root) solve();
	for (i = 1; i <= E; ++i)
		u = _u[i], v = _v[i], puts(connected[v][u] == reversible[u][v] ? "same" : "diff");
	return 0;
}