#include<bits/stdc++.h>
#define ll long long
#define pb emplace_back
#define mr make_pair
#define N 1010
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
int m,n,x,y,mi[N][N],ma[N][N],vi[N][N],p[1000010],q[1000010];
vector<int> a[N];
void d1(int be,int x){
	vi[be][x]=1;
	for (auto y:a[x])if (!vi[be][y]) d1(be,y);
}
void d3(int be,int zh,int x){
	if (mi[be][x]) return ;
	mi[be][x]=zh;
	for (auto y:a[x])if (!mi[be][y]) d3(be,zh,y);
}
void d2(int be,int zh,int x){
	if (ma[be][x]) return ;
	ma[be][x]=zh;
	for (auto y:a[x])if (!ma[be][y]) d2(be,zh,y);
}
int main(){
	read(n);read(m);
	for (int i=1;i<=m;i++){read(p[i]);read(q[i]);a[p[i]].pb(q[i]);}
	for (int i=1;i<=n;i++)d1(i,i);
	for (int i=1;i<=n;i++){
		sort(a[i].begin(),a[i].end());
		ma[i][i]=mi[i][i]=i;
		for (int j=0;j<a[i].size();j++)d3(i,a[i][j],a[i][j]);
		for (int j=a[i].size()-1;j>=0;j--)d2(i,a[i][j],a[i][j]);
	}
	for (int i=1;i<=m;i++){
		int x=p[i],y=q[i];
		if (vi[y][x]^(ma[x][y]!=y||mi[x][y]!=y))puts("diff");else puts("same");
	}
	return 0;
}