#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 1005
#define M 200005
vector<int>E[N];
int n, m, beg[N], len, num[N][N];
bool can[N][N], vis[N], can1[N][N];
int vis1[N], vis2[N], frm[M], tar[M];
void Dfs(int u, int rt)
{
	vis[u] = 1;
	can[rt][u] = 1;
	int t = E[u].size() - 1;
	for (int i = 0; i <= t; i++)
	{
		int v = E[u][i];
		if (vis[v])
			continue;
		Dfs(v, rt);
	}
}
void Dfs1(int u)
{
	vis[u] = 1;
	int t = E[u].size() - 1;
	for (int i = 0; i <= t; i++)
	{
		int v = E[u][i];
		if (vis[v])
			continue;
		vis1[v] = num[u][v];
		Dfs1(v);
	}
}
void Dfs2(int u)
{
	vis[u] = 1;
	int t = E[u].size() - 1;
	for (int i = t; i >= 0; i--)
	{
		int v = E[u][i];
		if (vis[v])
			continue;
		vis2[v] = num[u][v];
		Dfs2(v);
	}
}
int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; i++)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		E[u].push_back(v);
		num[u][v]=++len;
		frm[len]=u;
		tar[len]=v;
	}
	for (int i = 1; i <= n; i++)
	{
		Dfs(i,i);
		memset(vis, 0, sizeof(vis));
	}
	for (int i = 1; i <= n; i++)
	{
		Dfs1(i);
		memset(vis, 0, sizeof(vis));
		Dfs2(i);
		memset(vis, 0, sizeof(vis));
		int t =E[i].size()-1;
		for (int j = 0; j <= t; j++)
		{
			int v=E[i][j];
			if(vis1[v]!=num[i][v] || vis2[v]!=num[i][v])
				can1[i][v]=1;
		}
		memset(vis1, 0, sizeof(vis1));
		memset(vis2, 0, sizeof(vis2));
	}
	for (int i = 1; i <= m; i++)
	{
		int u = frm[i], v = tar[i];
		if (can[v][u] == can1[u][v])
			puts("same");
		else
			puts("diff");
	}
}
