#include <bits/stdc++.h>

using namespace std;

struct ede
{
	int v,nxt;
}e2[200050];

vector<pair<int,int> > edge[1050];

int head[1050],ecnt,hd[1050],ec;
int flg1[200050],flg2[200050];
int vis1[1050],vis2[1050];

inline void adde(int u,int v,int id)
{
	edge[u].push_back(make_pair(v,id));
	e2[++ ec].v = u;
	e2[ec].nxt = hd[v];
	hd[v] = ec;
}

void dfs1(int pos,int tag)
{
	vis1[pos] = tag;
	for(auto v : edge[pos])
	{
		if(!vis1[v.first])
			dfs1(v.first,tag);
	}
}

void dfs2(int pos,int tag)
{
	vis2[pos] = tag;
	for(auto v : edge[pos])
	{
		if(!vis2[v.first])
			dfs2(v.first,tag);
	}
}

int histo[200050],hc;

int main()
{
	int n,m; scanf("%d%d",&n,&m);
	for(int i = 1;i <= m; ++ i)
	{
		int u,v; scanf("%d%d",&u,&v);
		adde(u,v,i);
	}
	for(int i = 1;i <= n; ++ i)
	{
	//	cerr << i << endl;
		memset(vis1,0,sizeof(vis1));
		memset(vis2,0,sizeof(vis2));
		hc = 0;
		vis1[i] = vis2[i] = -1;
		for(auto v : edge[i])
		{
			if(!vis1[v.first])
				dfs1(v.first,v.second);
		}
		for(int j = edge[i].size() - 1;j >= 0; -- j)
		{
			auto v = edge[i][j];
			if(!vis2[v.first])
				dfs2(v.first,v.second);
			if(vis1[v.first] != vis2[v.first])
				flg2[v.second] = 1;
		}
		for(int j = hd[i];j;j = e2[j].nxt)
			if(vis1[e2[j].v])
				flg1[j] = 1;
	}
	for(int i = 1;i <= m; ++ i)
		puts(flg1[i] + flg2[i] == 1 ? "diff" : "same");
}