#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
const int N=1005;
int n,m,foo[N][N],bar[N][N],ans[N*200];
vector<int>E[N],Q[N];
void dfs(int u,int c,int *mrk){
	if(mrk[u])return;mrk[u]=c;
	for(int v:E[u])if(!mrk[v])dfs(v,c,mrk);
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1,x,y;i<=m;++i){
		scanf("%d%d",&x,&y);
		E[x].push_back(y);
		Q[x].push_back(i);
	}
	for(int i=1;i<=n;++i){
		foo[i][i]=bar[i][i]=-1;
		for(int j=0;j<E[i].size();++j)
			dfs(E[i][j],j+1,foo[i]);
		for(int j=E[i].size()-1;~j;--j)
			dfs(E[i][j],j+1,bar[i]);
	}
	for(int i=1;i<=n;++i)
		for(int j=0;j<E[i].size();++j){
			int x=(foo[E[i][j]][i]?1:0),y=(foo[i][E[i][j]]<=j)|(bar[i][E[i][j]]>j+1);
			ans[Q[i][j]]=x^y;
		}
	for(int i=1;i<=m;++i)puts(ans[i]?"diff":"same");
	return 0;
}
