#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

const int N=1e3+5;
const int M=2e5+5;

int n,m,A[M],B[M],vis[N],tag[N],flag[2][N][N];
vector <int> G[N];

template <typename _Tp> inline void IN(_Tp&x) {
	char ch;bool flag=0;x=0;
	while(ch=getchar(),!isdigit(ch)) if(ch=='-') flag=1;
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	if(flag) x=-x;
}

void dfs(int u,int rt) {
	if(vis[u]) return;
	flag[0][rt][u]=vis[u]=true;
	for(auto v:G[u]) dfs(v,rt);
}
void dfs(int u,int rt,int id,int now) {
	if(vis[u]) return;
	vis[u]=true;
	if(!now) tag[u]=id;
	else flag[1][rt][u]=(bool)(tag[u]!=id);
	for(auto v:G[u]) dfs(v,rt,id,now);
}

int main() {
	IN(n),IN(m);
	for(int i=1;i<=m;++i)
		IN(A[i]),IN(B[i]),G[A[i]].push_back(B[i]);
	for(int u=1;u<=n;++u) memset(vis,0,sizeof(vis)),dfs(u,u);
	for(int u=1;u<=n;++u) {
		memset(tag,0,sizeof(tag));
		memset(vis,0,sizeof(vis)),vis[u]=true;
		for(int i=0;i<=(int)G[u].size()-1;++i) dfs(G[u][i],u,i,0);
		memset(vis,0,sizeof(vis)),vis[u]=true;
		for(int i=(int)G[u].size()-1;i>=0;--i) dfs(G[u][i],u,i,1);
	}
	for(int i=1;i<=m;++i)
		puts(flag[0][B[i]][A[i]]^flag[1][A[i]][B[i]]?"diff":"same");
	return 0;
}