#include <cstdio>
#include <algorithm>
#include <vector>

const int MN = 1005, MM = 200005;

int N, M, eu[MM], ev[MM], Ans[MM];
std::vector<int> G[MN];
bool vis[MN], rch[MN][MN]; int col[MN];
void DFS(int u, int c) {
	vis[u] = 1, col[u] ^= c;
	for (auto i : G[u]) if (!vis[ev[i]]) DFS(ev[i], c);
}

int main() {
	scanf("%d%d", &N, &M);
	for (int i = 1; i <= M; ++i) {
		scanf("%d%d", &eu[i], &ev[i]);
		G[eu[i]].push_back(i);
	}
	for (int i = 1; i <= N; ++i) {
		for (int j = 1; j <= N; ++j) vis[j] = 0;
		DFS(i, 0);
		for (int j = 1; j <= N; ++j) if (vis[j]) rch[i][j] = 1;
	}
	for (int i = 1; i <= N; ++i) {
		for (int j = 1; j <= N; ++j) col[j] = vis[j] = 0; vis[i] = 1;
		for (auto j : G[i]) if (!vis[ev[j]]) DFS(ev[j], ev[j]);
		std::reverse(G[i].begin(), G[i].end());
		for (int j = 1; j <= N; ++j) vis[j] = 0; vis[i] = 1;
		for (auto j : G[i]) if (!vis[ev[j]]) DFS(ev[j], ev[j]);
		for (auto j : G[i]) Ans[j] = rch[ev[j]][i] ^ !!col[ev[j]];
	}
	for (int i = 1; i <= M; ++i) puts(Ans[i] ? "diff" : "same");
	return 0;
}