#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1005, maxm = 200005;

int n, m, num[maxn][maxn];
bool go[maxn][maxn], go2[maxn][maxn];

pii p[maxm];

vector<int> G[maxn];

bool vis[maxn];
int vis2[maxn], vis3[maxn];

void dfs1(int x, int rt)
{
	vis[x] = 1;
	if(x != rt)
		go[rt][x] = 1;
	int id;	
	for(int i = 0; i < (int)G[x].size(); ++i)
	{
		id = G[x][i];
		if(vis[id])	continue;
		dfs1(id, rt);
	}
}

void dfs2(int x)
{
	int id;
	for(int i = 0; i < (int)G[x].size(); ++i)
	{
		id = G[x][i];
		if(vis2[id])	continue;
		vis2[id] = num[x][id];
		dfs2(id);
	}
}

void dfs3(int x)
{
	int id;
	for(int i = (int)G[x].size() - 1; i >= 0; --i)
	{
		id = G[x][i];
		if(vis3[id])	continue;
		vis3[id] = num[x][id];
		dfs3(id);
	}
}

int main()
{
	scanf("%d%d", &n, &m);
	int u, v;	
	for(int i = 1; i <= m; ++i)
	{
		scanf("%d%d", &u, &v);
		memset(vis, 0, sizeof(vis));
		G[u].push_back(v);
		num[u][v] = i;
		p[i] = make_pair(u, v);
	}
	for(int i = 1; i <= n; ++i)
	{
		dfs1(i, i);
		vis2[i] = vis3[i] = -1;	
		dfs2(i);
		dfs3(i);
		int id;
		for(int j = 0; j < (int)G[i].size(); ++j)
		{
			id = G[i][j];
			if(vis2[id] != num[i][id] || vis3[id] != num[i][id])
			{
				go2[i][id] = 1;
			}
		}
		memset(vis, 0, sizeof(vis));
		memset(vis2, 0, sizeof(vis2));
		memset(vis3, 0, sizeof(vis3));
	}
	for(int i = 1; i <= m; ++i)
	{
		u = p[i].first;
		v = p[i].second;
		printf("%s\n", (go[v][u] && !go2[u][v]) || (!go[v][u] && go2[u][v])? "diff": "same");
	}
	return 0;
}
