#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector> 
#include <string>

using namespace std;
const int MAXN = 1e3 + 10;
struct node
{
	int nxt, id;
	node(int a, int b)
	{
		nxt = a;
		id = b;
	}
	node() {}
};
int n, m, tim;
int vis[MAXN];
int res[MAXN][MAXN][2];
int u[MAXN * MAXN], v[MAXN * MAXN];
vector <node> edge[MAXN];
inline void _read(int &x)
{
	x = 0;
	char t = getchar();
	while (!isdigit(t)) t = getchar();
	while (isdigit(t))
	{
		x = x * 10 + t - '0';
		t = getchar();
	}
}
inline void dfs(const int &now, const int fa, const int &b, const int &f)
{
	vis[now] = tim;
	res[fa][now][f] = b;
	register int len = edge[now].size();
	for (register int i = 0; i < len; i++)
		if (vis[edge[now][i].nxt] != tim)
			dfs(edge[now][i].nxt, fa, b, f);
}
inline void solve(const int & now)
{
	tim++; vis[now] = tim;
	register int len = edge[now].size();
	for (register int i = 0; i < len; i++)
		if (vis[edge[now][i].nxt] != tim)
			dfs(edge[now][i].nxt, now, edge[now][i].id, 0);

	reverse(edge[now].begin(), edge[now].end());

	vis[now] = ++tim;
	for (register int i = 0; i < len; i++)
		if (vis[edge[now][i].nxt] != tim)
			dfs(edge[now][i].nxt, now, edge[now][i].id, 1);
}
int main(int argc, char **Argv)
{
	_read(n), _read(m);
	for (register int i = 1; i <= m; i++)
	{
		_read(u[i]), _read(v[i]);
		edge[u[i]].push_back(node(v[i], i));
	}
	for (register int i = 1; i <= n; i++)
		solve(i);
	for (register int i = 1; i <= m; i++)
	{
		if ((res[v[i]][u[i]][0] != 0) ^ 0 ^ (res[u[i]][v[i]][0] != i || res[u[i]][v[i]][1] != i))
			puts("diff");
		else
			puts("same");
	}
	return 0;
}