#include<bits/stdc++.h>
using namespace std;
const int N=1005;
int n,m,i,x,y,ans[200005],dfn[N],low[N],xb,st[N],w,bel[N],scnt;
vector<pair<int,int>>e[N],tmp,tmp2;
bool b[N];
void dfs(int x){
	dfn[x]=low[x]=++xb;st[++w]=x;
	for(auto u:e[x])if(!dfn[u.first]){
		dfs(u.first);low[x]=min(low[x],low[u.first]);
	}else if(!bel[u.first])low[x]=min(low[x],low[u.first]);
	if(dfn[x]==low[x])for(++scnt;;){
		bel[st[w]]=scnt;
		for(auto u:e[st[w]])if(bel[u.first] && bel[u.first]!=scnt)ans[u.second]=1;
		if(st[w--]==x)break;
	}
}
void dfs2(int x){b[x]=1;for(auto u:e[x])if(!b[u.first])dfs2(u.first);}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	cin>>n>>m;
	for(i=1;i<=m;++i)cin>>x>>y,e[x].push_back(make_pair(y,i));
	for(i=1;i<=n;++i)if(!dfn[i])dfs(i);
	for(i=1;i<=n;++i){
		memset(b+1,0,n);b[i]=1;tmp.clear();tmp2.clear();
		for(auto u:e[i])if(!b[u.first])tmp.push_back(u),dfs2(u.first);
			else tmp2.push_back(u);
		memset(b+1,0,n);b[i]=1;reverse(tmp.begin(),tmp.end());
		for(auto u:tmp2)dfs2(u.first);
		for(auto u:tmp)if(!b[u.first])ans[u.second]^=1,dfs2(u.first);
	}
	for(i=1;i<=m;++i)cout<<(ans[i]?"diff\n":"same\n");
	return 0;
}