#include <bits/stdc++.h>
const int N=1e3+5,M=2e5+5;
using namespace std;
struct Edge{
	int u,v;
}e[M];
bool g1[N][N],g2[N][N],used[N];
int n,m,Mark[N];
bool flag;
vector<int>to[N];
void DFS(int p,int s){
	g1[s][p]=used[p]=1;
	register int i;
	for(i=0;i!=to[p].size();++i)
		if(!used[to[p][i]]) DFS(to[p][i],s);
}
void _DFS(int p,int col,int s){
	//cout<<p<<
	if(flag) g2[s][p]=Mark[p]!=col;
	else Mark[p]=col;
	register int i;used[p]=1;
	for(i=0;i!=to[p].size();++i)
		if(!used[to[p][i]]) _DFS(to[p][i],col,s);
}
int main(){
	
	register int i,j,x,y;
	scanf("%d%d",&n,&m);
	for(i=1;i<=m;++i){
		scanf("%d%d",&x,&y);
		to[x].push_back(y);
		e[i]=(Edge){x,y};
	}
	for(i=1;i<=n;++i) DFS(i,i),memset(used,0,sizeof used);
	for(i=1;i<=n;++i){
		for(j=0;j<=n;++j) Mark[j]=0;
		for(j=1;j<=n;++j) used[j]=0;used[i]=1;flag=0; 
		for(j=0;j!=to[i].size()  ;++j) if(!used[to[i][j]]) _DFS(to[i][j],j,i);
		for(j=1;j<=n;++j) used[j]=0;used[i]=1;flag=1;
		for(j=to[i].size()-1;j>=0;--j) if(!used[to[i][j]]) _DFS(to[i][j],j,i);
	}
	for(i=1;i<=m;++i)
		puts((g1[e[i].v][e[i].u]^g2[e[i].u][e[i].v])?"diff":"same");
	return 0;
}