#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

const int maxN = 1005;
struct edge{
	int v, idx;
	edge(){};
	edge(int v_, int idx_) {
		v = v_; idx = idx_;
	} 
};
int N, M, U[maxN * maxN], V[maxN * maxN], tim, vis[maxN], bel[maxN][maxN][2];
vector<edge> sons[maxN];

void dfs(int u, int fa, int t, int f) {
	//cout << u << endl;
	vis[u] = tim; bel[fa][u][f] = t;
	int sz = sons[u].size();
	for(int i = 0; i < sz; ++i) {
		if(vis[sons[u][i].v] != tim) {
			dfs(sons[u][i].v, fa, t, f);
		}
	}
}

void solve(int u) {
	vis[u] = ++tim;
	int sz = sons[u].size();
	for(int i = 0; i < sz; ++i) {
		if(vis[sons[u][i].v] != tim) {
			dfs(sons[u][i].v, u, sons[u][i].idx, 0);
		}
	}
	reverse(sons[u].begin(), sons[u].end());
	vis[u] = ++tim;
	for(int i = 0; i < sz; ++i) {
		if(vis[sons[u][i].v] != tim) {
			dfs(sons[u][i].v, u, sons[u][i].idx, 1);
		}
	}	
}

int main() {
	//freopen("input.txt", "r", stdin);
	scanf("%d%d", &N, &M);
	for(int i = 1; i <= M; ++i) {
		scanf("%d%d", &U[i], &V[i]);
		sons[U[i]].push_back(edge(V[i], i));
	}
	for(int i = 1; i <= N; ++i) solve(i);
	for(int i = 1; i <= M; ++i) {
		if((bel[V[i]][U[i]][0] != 0) ^ ((bel[U[i]][V[i]][0] != i) || (bel[U[i]][V[i]][1] != i)))
			printf("diff\n");
		else printf("same\n");
	}
	return 0;
}