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

int n, m, x[200005], y[200005], mn[1005], mx[1005];
vector<int> g[1005];
bool bs[1005][1005], ans[200005];

void dfs(int u, bool *bs) {
	if (bs[u]) return;
	bs[u] = true;
	for (int e : g[u]) dfs(y[e], bs);
}
void dfs(int u, int *bel, int what, int ban) {
	if (bel[u] || u == ban) return;
	bel[u] = what;
	for (int e : g[u]) dfs(y[e], bel, what, ban);
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; ++i) {
		scanf("%d%d", x + i, y + i);
		g[x[i]].push_back(i);
	}
	for (int i = 1; i <= n; ++i)
		dfs(i, bs[i]);
	for (int i = 1; i <= n; ++i) {
		memset(mn, 0, sizeof mn);
		memset(mx, 0, sizeof mx);
		for (int e : g[i]) dfs(y[e], mn, e, i);
		reverse(g[i].begin(), g[i].end());
		for (int e : g[i]) dfs(y[e], mx, e, i);
		for (int e : g[i])
			if (mn[y[e]] != mx[y[e]]) ans[e] = 1;
	}
	for (int i = 1; i <= m; ++i) {
		ans[i] ^= bs[y[i]][x[i]];
		puts(ans[i] ? "diff" : "same");
	}
	return 0;
}
