#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;
typedef long long LL;
const LL N = 2005;
const LL M = 400005;

vector <LL> G[N];
LL vis[2][N][N],p[2][N],vi[N];
LL eu[M],ev[M],n,m;

void dfs_vis(LL u,LL rt){
	vis[0][rt][u] = 1;
	vi[u] = 1;
	for(LL i = 0;i < G[u].size();i ++){
		LL v = ev[G[u][i]];
		if(vi[v]) continue;
		dfs_vis(v,rt);
	}
}

void get_vis(){
	for(LL i = 1;i <= n;i ++){
		memset(vi,0,sizeof(vi));
		dfs_vis(i,i);
	}
}

void dfs_sol(LL u,LL col,LL pid,LL rt){
	p[pid][u] = col;
	vi[u] = 1;
	for(LL i = 0;i < G[u].size();i ++){
		LL v = ev[G[u][i]];
		if(vi[v]) continue;
		dfs_sol(v,col,pid,rt);
	}
}

void solve(LL u){
	memset(p,0,sizeof(p));
	memset(vi,0,sizeof(vi)); vi[u] = 1;
	for(LL i = 0;i < G[u].size();i ++) if(!vi[ev[G[u][i]]]) dfs_sol(ev[G[u][i]],i + 1,0,u);
	memset(vi,0,sizeof(vi)); vi[u] = 1;
	for(LL i = (LL)(G[u].size()) - 1;i >= 0;i --) if(!vi[ev[G[u][i]]]) dfs_sol(ev[G[u][i]],i + 1,1,u);
	for(LL i = 1;i <= n;i ++) if(vi[i] && p[0][i] != p[1][i]) vis[1][u][i] = 1;
}

int main(){
	ios::sync_with_stdio(false);
	cin >> n >> m;
	for(LL i = 1;i <= m;i ++){
		cin >> eu[i] >> ev[i];
		G[eu[i]].push_back(i);
	}
	get_vis();
	for(LL i = 1;i <= n;i ++) solve(i);
//	for(LL i = 1;i <= m;i ++) cout << ans[0][i] << ' ' << ans[1][i] << endl;
	for(LL i = 1;i <= m;i ++) cout << ((vis[0][ev[i]][eu[i]] ^ vis[1][eu[i]][ev[i]]) ? "diff" : "same") << '\n';
	return 0;
}