#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;

vector<int>E[1010];
int n, m, b[200020][2];
bool vis[1010], f[200020][2];
int q[1010], h, t, l[1010], r[1010];
int st[1010], tp;

void dfs1(int v, int a[], int w) {
	vis[v] = 1, a[v] = w;
	for (auto u : E[v])if (!vis[u])dfs1(u, a, w);
}

void work(int v) {
	tp = 0;
	for (auto u : E[v])st[++tp] = u;
	memset(vis + 1, 0, n); vis[v] = 1;
	for (int i = 1; i <= tp; i++)if (!vis[st[i]])dfs1(st[i], l, i);
	memset(vis + 1, 0, n); vis[v] = 1;
	for (int i = tp; i; i--)if (!vis[st[i]])dfs1(st[i], r, i);
	for (int i = 1; i <= m; i++)if (b[i][0] == v)f[i][0] = l[b[i][1]] != r[b[i][1]];
}

void dfs(int v) {
	vis[v] = 1;
	for (auto u : E[v])if (!vis[u])dfs(u);
}

int main() {
	scanf("%d %d", &n, &m);
	int x, y;
	for (int i = 1; i <= m; i++)scanf("%d %d", &x, &y), E[x].emplace_back(y), b[i][0] = x, b[i][1] = y;
	for (int i = 1; i <= n; i++) {
		memset(vis + 1, 0, n);
		dfs(i);
		for (int j = 1; j <= m; j++)if (b[j][1] == i)f[j][1] = vis[b[j][0]];
	}
	for (int i = 1; i <= n; i++)work(i);
	for (int i = 1; i <= m; i++) {
		if (f[i][0] != f[i][1])puts("diff");
		else puts("same");
	}

	return 0;
}