#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<algorithm>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef pair<int,int> P;
const int N=1010,M=200200;
int n,m,u,v,vi[N],bo[N],g[N][N],ans[M];
map<P,int>id;
vector<int>ve[N];
void dfs(int u,int*a){a[u]=1;for(int v:ve[u])if(!a[v]) dfs(v,a);}
void work(int u){
	FOR(i,1,n) vi[i]=i==u;
	for(int v:ve[u]) vi[v]?bo[v]=1:(dfs(v,vi),0);
}
int main(){
	//freopen("1.in","r",stdin);
	scanf("%d%d",&n,&m);
	FOR(i,1,m) scanf("%d%d",&u,&v),ve[u].push_back(v),id[P(u,v)]=i;
	FOR(i,1,n) dfs(i,g[i]);
	FOR(i,1,n){
		for(int v:ve[i]) bo[v]=0;
		work(i);
		reverse(ve[i].begin(),ve[i].end());
		work(i);
		for(int v:ve[i]) ans[id[P(i,v)]]=g[v][i]^bo[v];
	}
	FOR(i,1,m) puts(ans[i]?"diff":"same");
}
