#include<cstdio>
#include<cstring>
#define retrun return
#define cpnst const
int n,m;
#include<vector>
std::vector<int>v[1111111];
int lnk[1111][1111];
bool vis[1111111];
bool isp[1111][1111],isq[1111][1111];
#include<queue>
#include<algorithm>
std::queue<int>q;
void flood(int x,bool*vs)
{
	q.push(x),vs[x]=1;
	for(;!q.empty();)
	{
		int p=q.front();q.pop();
		for(auto t:v[p])
			if(!vs[t])q.push(t),vs[t]=1;
	}
}
void bfs(int x)
{
	register int i;
	for(i=1;i<=n;i++)vis[i]=0;vis[x]=1;
	for(auto t:v[x])
	{
		isp[x][t]|=vis[t];
		if(!vis[t])flood(t,vis);
	}for(i=1;i<=n;i++)vis[i]=0;vis[x]=1;
	std::reverse(v[x].begin(),v[x].end());
	for(auto t:v[x])
	{
		isp[x][t]|=vis[t];
		if(!vis[t])flood(t,vis);
	}flood(x,isq[x]);
}
int x[1111111],y[1111111];
int main()
{
	scanf("%d%d",&n,&m);
	register int i;
	for(i=1;i<=m;i++)scanf("%d%d",x+i,y+i),lnk[x[i]][y[i]]=lnk[y[i]][x[i]]=i,
	v[x[i]].push_back(y[i]);
	for(i=1;i<=n;i++)bfs(i);
	for(i=1;i<=m;i++)puts((isp[x[i]][y[i]]^isq[y[i]][x[i]])?"diff":"same");
}
/*
Just go for it.
*/