#include <bits/stdc++.h>
using namespace std;
using pi = pair<int, int>;
const int MAXN = 1005;
const int MAXM = 200005;

vector<int> gph[MAXN];
int adj[MAXN][MAXN], vis[MAXN];
int n, m;
int s[MAXM], e[MAXM];

void dfs(int r, int v){
	vis[v] = 1;
	adj[r][v]++;
	for(auto &i : gph[v]){
		if(i == r) continue;
		if(!vis[i] && adj[r][i] < 2){
			dfs(r, i);
		}
	}
}

int main(){
	cin >> n >> m;
	for(int i=0; i<m; i++){
		scanf("%d %d",&s[i],&e[i]);
		gph[s[i]].push_back(e[i]);
	}
	for(int i=1; i<=n; i++){
		for(auto &j : gph[i]){
			if(adj[i][j] < 2){
				memset(vis, 0, sizeof(vis));
				dfs(i, j);
			}
		}
	}
	for(int i=0; i<m; i++){
		if(adj[e[i]][s[i]] == 0){
			puts(adj[s[i]][e[i]] > 1 ? "diff" : "same");
		}
		else{
			puts(adj[s[i]][e[i]] > 1 ? "same" : "diff");
		}
	}
}
