#include <iostream>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <vector>
#include <set>
using namespace std;

void read(int &x)
{
	char ch=getchar();bool f=0;x=0;
	while(ch>'9'||ch<'0'){if(ch=='-')f=1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	if(f)x=-x;
} 

void read(long long &x)
{
	char ch=getchar();bool f=0;x=0;
	while(ch>'9'||ch<'0'){if(ch=='-')f=1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	if(f)x=-x;
}


vector <int> graph[1001];

void addedge(int u,int v)
{
	graph[u].push_back(v);
}

int vis[1001][1001];
struct
{
	int first,second;
}edge[200001];
int mark[1001];
int times=1;
int tmp;

void dfs(int from,int now)
{
	vis[from][now]++;
	mark[now]=1;
	for(auto to:graph[now])
	{
		if(to==from)continue;
		if(vis[from][to]<2&&!mark[to])
		{
			dfs(from,to);
		}
	}
}

int main()
{
//	freopen("sep2_0.in","r",stdin);
//	freopen("sep.out","w",stdout);
	int n,m;
	read(n);read(m);
	for(int i=0;i<m;i++)
	{
		int from,to;
		read(from);read(to);
		addedge(from,to);
		edge[i].first=from;
		edge[i].second=to;
	}
	for(int i=1;i<=n;i++)
	{
		for(auto to:graph[i])
		{
			if(vis[i][to]<2)
			{
				memset(mark,0,sizeof(mark));
				dfs(i,to);
				
			}
		}
	}
	//return 0;
/*	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			cout<<"("<<vis[i][j]<<","<<vis2[i][j]<<")";
		}
		cout<<endl;
	}*/
	for(int i=0;i<m;i++)
	{
		int from=edge[i].first,to=edge[i].second;
		if(vis[to][from])
		{
			if(vis[from][to]>1)
			{
				puts("same");
			}
			else
			{
				puts("diff");
			}
		}
		else
		{
			if(vis[from][to]>1)
			{
				puts("diff");
			}
			else
			{
				puts("same");
			}
		}
	}
	return 0;
}
/*
3 3
1 2
1 3
2 3

2 2
1 2
2 1
*/
