//minamoto
#include<bits/stdc++.h>
#define R register
#define pb push_back
#define fi first
#define se second
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef pair<int,int> pi;
const int N=1005,M=2e5+5;
vector<pi>to[N];
int ans[M];
int dfn[N],low[N],st[N],col[N],tim,top,cnt,n,m;
void tarjan(int u){
	dfn[u]=low[u]=++tim,st[++top]=u;
	for(auto v:to[u])if(!dfn[v.fi])tarjan(v.fi),cmin(low[u],low[v.fi]);
	else if(!col[v.fi])cmin(low[u],dfn[v.fi]);
	if(dfn[u]==low[u])
		for(++cnt;st[top+1]!=u;--top)col[st[top]]=u;
}
int q[M<<3],fr[N],vis[N];
inline int trs(R int &x,R int y){return x==y?0:(x=!x?y:1023,1);}
void bfs(int rt){
	int h=1,t=0,u;
	fp(i,1,n)vis[i]=fr[i]=0;
	for(auto v:to[rt])fr[v.fi]=v.fi,q[++t]=v.fi,vis[v.fi]=1;
	while(h<=t){
		u=q[h++],vis[u]=1;
		for(auto v:to[u])if(v.fi!=rt&&trs(fr[v.fi],fr[u])&&!vis[v.fi])q[++t]=v.fi,vis[v.fi]=1;
	}
	for(auto v:to[rt])ans[v.se]=(fr[v.fi]==1023)^(col[rt]==col[v.fi]);
}
int main(){
//	freopen("testdata.in","r",stdin); 
	scanf("%d%d",&n,&m);
	for(R int i=1,u,v;i<=m;++i)scanf("%d%d",&u,&v),to[u].pb(pi(v,i));
	fp(i,1,n)if(!dfn[i])tarjan(i);
	fp(i,1,n)bfs(i);
	fp(i,1,m)puts(ans[i]?"diff":"same");
	return 0;
}