//copied
#include<bits/stdc++.h>

using namespace std;

#define N 1200
#define M 300000

int n,m,x[M],y[M],vis[2][N][N];
vector<int> vec[N];

void dfs(int op,int o,int u,int k){
	if (vis[op][o][u]) return;
	vis[op][o][u]=k;
	for (int i=0;i<(int)vec[u].size();++i)
		dfs(op,o,vec[u][i],k);
}

int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;++i){scanf("%d%d",&x[i],&y[i]); vec[x[i]].push_back(y[i]);}
	for (int i=1;i<=n;++i){
		vis[0][i][i]=vis[1][i][i]=1;
		for (int j=0;j<(int)vec[i].size();++j)
			dfs(0,i,vec[i][j],j+1);
		if (vec[i].size())
			for (int j=(int)vec[i].size()-1;j>=0;--j)
				dfs(1,i,vec[i][j],j+1);
	}
	for (int i=1;i<=m;++i){
		int u=x[i],v=y[i];
		puts((vis[0][u][v]!=vis[1][u][v])^(vis[0][v][u]>0)?"diff":"same");
	}

	return 0;
}
