#include<bits/stdc++.h>
#define N 1050
#define M 500050
using namespace std;
int n,m;
struct node{
	int x,y;
}ed[M];
bitset<N>pd1[N],pd2[N],vis;
vector<int>v[N];
inline void dfs(int g,int fa){
	vis[g]=1;pd1[fa][g]=1;
	for(int to:v[g])if(!vis[to])dfs(to,fa);
}
int tag[N];
inline void dfs2(int g,int t){
	if(vis[g])return;
	vis[g]=1;tag[g]=t;
	for(int to:v[g])if(!vis[to])dfs2(to,t);
}
inline void dfs3(int g,int t,int rt){
	if(vis[g])return;
	vis[g]=1;if(tag[g]!=t)pd2[rt][g]=1;
	for(int to:v[g])if(!vis[to])dfs3(to,t,rt);
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;++i)scanf("%d%d",&ed[i].x,&ed[i].y),v[ed[i].x].push_back(ed[i].y);
	for(int i=1;i<=n;++i)vis.reset(),dfs(i,i);
	for(int i=1;i<=n;++i){
		vis.reset();vis[i]=1;
		for(int to:v[i])dfs2(to,to);
		vis.reset();vis[i]=1;
		reverse(v[i].begin(),v[i].end());
		for(int to:v[i])dfs3(to,to,i);
	}
	for(int i=1;i<=m;++i){
		puts((pd1[ed[i].y][ed[i].x]^pd2[ed[i].x][ed[i].y])?"diff":"same");
	}
	return 0;
}