#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector> 
#define MN 1010 
#define MM 201000

typedef std::pair<int, int> P;

P d[MN][2], q[MN * 2];
int Ans[MN][MN], Ans2[MN][MN];
int hh = 0, tt = 0;
int x[MM], y[MM];
std::vector<int> to[MN];

void bfs(int S)
{
	hh = 0; tt = 0;
	memset(d, -1, sizeof(d));
    for(int i = 0; i < to[S].size(); i++)
		d[to[S][i]][0] = P(1, to[S][i]), q[tt++] = P(to[S][i], 0);
	while(hh < tt)
	{
		int u = q[hh].first, o = q[hh].second; hh++;
    	for(int i = 0; i < to[u].size(); i++)
		{
			if(to[u][i] == S) continue;
			if(d[to[u][i]][0].first == -1)
			{
				d[to[u][i]][0].first = d[u][o].first + 1;
				d[to[u][i]][0].second = d[u][o].second;
				q[tt++] = P(to[u][i], 0);
			}
			else if(d[to[u][i]][1].first == -1 && d[to[u][i]][0].second != d[u][o].second)
			{
				d[to[u][i]][1].first = d[u][o].first + 1;
				d[to[u][i]][1].second = d[u][o].second;
				q[tt++] = P(to[u][i], 1);
			}
		}
	}
}

int main()
{
	int n, m; scanf("%d%d", &n, &m);
	for(int i = 1; i <= m; i++)
	{
		scanf("%d%d", &x[i], &y[i]);
		to[x[i]].push_back(y[i]);
	}
	for(int i = 1; i <= n; i++)
	{
		bfs(i);
		for(int j = 1; j <= n; j++)
		{
			if(d[j][0].second != j) Ans[i][j] = d[j][0].first;
			else Ans[i][j] = d[j][1].first;
			Ans2[i][j] = d[j][0].first; 
		}
	}
	for(int i = 1; i <= m; i++) 
	{
		if(Ans[x[i]][y[i]] == -1 && Ans2[y[i]][x[i]] != -1 || Ans[x[i]][y[i]] != -1 && Ans2[y[i]][x[i]] == -1)
			puts("diff");
		else puts("same");
	}
}