#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,u) for(int i=start[u];i;i=e[i].next)
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
#define SZ(A) ((int)A.size())
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
inline int read()
{
	int s=0,f=1;char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')ch=getchar(),f=-1;
	while(isdigit(ch))s=s*10+ch-'0',ch=getchar();
	return ~f?s:-s;
}

const int maxn=1e3+20;

struct node {
	int v,next;
};
node e[200020];
int cnt,start[maxn];
inline void addedge(int u,int v){ e[++cnt]=(node){v,start[u]};start[u]=cnt;}

int n,m;
int f[maxn][maxn];
int rt,D;
int g[maxn][maxn];
int vis[maxn];
int A[maxn],B[maxn];
int graph[maxn][maxn];

void dfs(int u)
{
	f[rt][u]=1;
	EREP(i,u)
	{
		int v=e[i].v;
		if(f[rt][v])continue;
		dfs(v);
	}
}

struct Edge {
	int u,v;
};
Edge E[200020];

void dfs1(int u)
{
	vis[u]=D;
	EREP(i,u)
	{
		int v=e[i].v;
		if(vis[v])continue;
		dfs1(v);
	}
}

inline void init()
{
	n=read(); m=read();
	REP(i,1,m)
	{
		int u=read(),v=read();
		E[i]=(Edge){u,v};
		addedge(u,v);
		graph[u][v]=1;
	}
	REP(u,1,n)
	{
		rt=u;
		dfs(u);
	}
	REP(u,1,n)
	{
		static int st[maxn],top; top=0;
		EREP(i,u)st[++top]=e[i].v;
		memset(vis,0,sizeof(int)*(n+1));
		vis[u]=top+1;
		REP(j,1,top)
		{
			D=j;
			if(!vis[st[j]])dfs1(st[j]);
		}
		memcpy(A,vis,sizeof(int)*(n+1));
		memset(vis,0,sizeof(int)*(n+1));
		vis[u]=top+1;
		DREP(j,top,1)
		{
			D=j;
			if(!vis[st[j]])dfs1(st[j]);
		}
		memcpy(B,vis,sizeof(int)*(n+1));
		REP(j,1,top)if(A[st[j]]!=B[st[j]])g[u][st[j]]=1;
		
	}
}

inline void doing()
{
	REP(i,1,m)
	{
		int u=E[i].u,v=E[i].v;
		if(f[v][u]^(g[u][v]))puts("diff");
		else puts("same");
	}
}

int main()
{
#endif
	init();
	doing();
	return 0;
}
