#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
using namespace std;
typedef long long LL;
const int N = 1005;
const int M = 200005;

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

int n, m, U[M], V[M], id[N][N], ID;
vector<int> e[N];
int vis1[N], vis2[N];
bool vis[N], ok1[N][N], ok2[N][N]; 

void DFS1(int u, int rt) {
	ok1[rt][u] = vis[u] = 1;
	for (auto v : e[u]) {
		if (vis[v]) continue;
		DFS1(v, rt);
	}
}

void DFS2(int u, int tp) {
	vis[u] = 1;
	for (auto v : e[u]) {
		if (vis[v]) continue;
		(tp == 1? vis1[v] : vis2[v]) = id[u][v];
		DFS2(v, tp);
	}
}

void init() {
	read(n); read(m);
	for (int i = 1, u, v; i <= m; ++i) {
		read(u); read(v);
		U[i] = u; V[i] = v;
		id[u][v] = ++ID;
		e[u].push_back(v);
	}
}

void solve() {
	for (int i = 1; i <= n; ++i) {
		mset(vis, 0);
		DFS1(i, i);
	}
	for (int i = 1; i <= n; ++i) {
		mset(vis, 0);
		mset(vis1, 0);
		DFS2(i, 1);
		reverse(e[i].begin(), e[i].end());
		mset(vis, 0);
		mset(vis2, 0);
		DFS2(i, 2);
		for (auto v : e[i]) {
			ok2[i][v] = (vis1[v] != id[i][v] || vis2[v] != id[i][v]);
		}
	}
	for (int i = 1; i <= m; ++i) {
		int u = U[i], v = V[i];
		puts(ok1[v][u] == ok2[u][v]? "same" : "diff");
	}
}

int main() {
	init();
	solve();
	return 0;
}
