#include<bits/stdc++.h>
#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)
#define fd(i,a,b)for(int i=b,_e=a;i>=_e;--i)
#define P pair<int,int>
#define fi first
#define se second
#define pb push_back
using namespace std;
const int N=1005,M=2e5+5;
int n,m,x,y;
int d[N];
vector<P>e[N];
vector<int>e2[N];
bool can[M],bz[N],bz2[N];
void cover(int x){
	if(bz2[x])return;
	bz2[x]=1;d[1]=x;
	for(int l=0,r=1;x=d[++l],l<=r;)
		for(P i:e[x])if(!bz2[i.fi])
			bz2[i.fi]=1,d[++r]=i.fi;
}
int main(){
	ios::sync_with_stdio(0);
	cin>>n>>m;
	fo(i,1,m){
		cin>>x>>y;
		e[x].pb(P(y,i));
		e2[y].pb(x);
	}
	fo(i,1,n){
		fo(j,1,n)bz2[j]=bz[j]=0;
		d[1]=i;bz[i]=1;
		for(int l=0,r=1;x=d[++l],l<=r;)
			for(int i:e2[x])if(!bz[i])
				bz[i]=1,d[++r]=i;
		bz2[i]=1;
		for(P j:e[i]){
			can[j.se]=bz2[j.fi];
			cover(j.fi);
		}
		fo(j,1,n)bz2[j]=0;
		bz2[i]=1;
		fd(j,0,e[i].size()-1){
			x=e[i][j].fi;
			y=e[i][j].se;
			can[y]|=bz2[x];
			cover(x);
			can[y]=can[y]?(bz[x]?0:1):(bz[x]?1:0);
		}
	}
	fo(i,1,m)printf(can[i]?"diff\n":"same\n");
}