#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n, m;
vector<int> G[1005], revG[1005];
int u[200005], v[200005];
int reach[1005][1005];
vector<int> topo;
bool used[1005];
int scc[1005];

void tpsort(int v)
{
	used[v] = true;
	for(int i = 0; i < G[v].size(); i++){
		if(!used[G[v][i]]) tpsort(G[v][i]);
	}
	topo.push_back(v);
}
void sccdfs(int v, int id)
{
	used[v] = true;
	scc[v] = id;
	for(int i = 0; i < revG[v].size(); i++){
		if(!used[revG[v][i]]) sccdfs(revG[v][i], id);
	}
}

void dfs(int v, int s, int t)
{
	if(reach[s][v] == 0) reach[s][v] = t;
	else reach[s][v] = -1;
	
	int u;
	for(int i = 0; i < G[v].size(); i++){
		u = G[v][i];
  		if(reach[s][u] == -1 || reach[s][u] == t) continue;
		dfs(u, s, t);
	}
}

int main(void)
{
	cin >> n >> m;
	for(int i = 1; i <= m; i++){
		cin >> u[i] >> v[i];
		G[u[i]].push_back(v[i]);
		revG[v[i]].push_back(u[i]);
	}
	
	for(int i = 1; i <= n; i++){
		reach[i][i] = -1;
		for(int j = 0; j < G[i].size(); j++){
			dfs(G[i][j], i, G[i][j]);
		}
	}
	
	for(int i = 1; i <= n; i++) if(!used[i]) tpsort(i);
	reverse(topo.begin(), topo.end());
	int id = 0;
	for(int i = 1; i <= n; i++) used[i] = false;
	for(int i = 0; i < topo.size(); i++) if(!used[topo[i]]) sccdfs(topo[i], id++);
	
	for(int i = 1; i <= m; i++){
		if(scc[u[i]] != scc[v[i]]){
			if(reach[u[i]][v[i]] == -1) cout << "diff" << "\n";
			else cout << "same" << "\n";
		}
		else{
			if(reach[u[i]][v[i]] != -1) cout << "diff" << "\n";
			else cout << "same" << "\n";
		}
	}
	flush(cout);
	
	return 0;
}