#include <bits/stdc++.h>

using namespace std;

const int maxn = 1010;
const int maxm = 200010;
const int inf = 0x3f3f3f3f;

int l[maxn], e, ban_id;

struct Edge {
	int v, id, x;
} E[maxm];

queue<int> q[maxn];
int e_u[maxm], e_v[maxm], Q[maxn], vis[maxn], Ed[maxn][maxn], n, m;
int col[maxn], rt[maxn], dfn[maxn], low[maxn], sta[maxn], cnt, top, tim;
int fa[maxn][20], dep[maxn], mx[maxn][maxn], imp[maxm], f[maxn];

vector<int> vec[maxn][maxn];
vector<int> st[maxn];
vector<int> G[maxn];

inline void addEdge(int u, int v, int id) {
	E[e].v = v, E[e].x = l[u], E[e].id = id, l[u] = e++;
}

void init_vis() {
	for (int i = 1; i <= n; i++) vis[i] = 0;
}

void dfs_calmx(int u) {
	vis[u] = 1;
	for (int i = 1; i <= cnt; i++) mx[u][i] = -inf;
	mx[u][u] = 0;
	for (int i = 0; i < G[u].size(); i++) {
		int v = G[u][i];
		if (!vis[v]) dfs_calmx(v);
		for (int j = 1; j <= cnt; j++) mx[u][j] = max(mx[u][j], mx[v][j] + 1);
	}
}

int check(int a, int b) {
	init_vis();
	vis[a] = 1;
	int s = 0, t = 0; Q[t++] = a;
	while (s < t) {
		int u = Q[s++];
		if (u == b) return 1;
		for (int p = l[u]; p >= 0; p = E[p].x) {
			int v = E[p].v;
			if (E[p].id != ban_id && !vis[v]) {
				vis[v] = 1;
				Q[t++] = v;
			}
		}
	}
	return 0;
}

void tarjan(int u) {
	dfn[u] = low[u] = ++ tim; sta[++ top] = u; vis[u] = 1;
	for (int p = l[u]; p >= 0; p = E[p].x) {
		int v = E[p].v;
		if (!dfn[v]) {
			tarjan(v);
			low[u] = min(low[u], low[v]);
		} else if (vis[v]) {
			low[u] = min(low[u], dfn[v]);
		}
	}
	if (low[u] == dfn[u]) {
		int t = 0; rt[++ cnt] = u;
		do {
			t = sta[top --];
			col[t] = cnt;
			vis[t] = 0;
		} while (t != u);
	}
}

void dfs_buildtree(int u, int f) {
	vis[u] = 1;
	fa[u][0] = f;
	for (int i = 1; i < 20; i++) fa[u][i] = fa[fa[u][i-1]][i-1];
	for (int p = l[u]; p >= 0; p = E[p].x) {
		int v = E[p].v;
		if (col[v] == col[u] && !vis[v]) {
			dep[v] = dep[u] + 1;
			imp[E[p].id] = 1;
			dfs_buildtree(v, u);
		}
	}
}

void solve(int c) {
	while (!q[c].empty()) {
		int ind = q[c].front(); q[c].pop();
		int u = e_u[ind], v = e_v[ind];
		if (f[u] != f[v]) {
			imp[ind] = 1;
			while (f[u] != f[v]) {
				int x = f[fa[f[u]][0]];
				int y = f[u];
				for (int i = 0; i < st[x].size(); i++) {
					for (int j = 0; j < st[y].size(); j++) {
						for (int k = 0; k < vec[st[x][i]][st[y][j]].size(); k++) {
							q[c].push(vec[st[x][i]][st[y][j]][k]);
						}
					}
				}
				for (int i = 0; i < st[y].size(); i++) f[st[y][i]] = x, st[x].push_back(st[y][i]);
			}
		}
	}
}

int lca(int u, int v) {
	if (dep[u] < dep[v]) swap(u, v);
	if (dep[u] > dep[v]) {
		int c = dep[u] - dep[v];
		for (int i = 0; i < 20; i++) {
			if (c & (1<<i)) {
				u = fa[u][i];
			}
		}
	}
	if (u == v) return u;
	for (int i = 19; i >= 0; i--) {
		if (fa[u][i] != fa[v][i]) {
			u = fa[u][i];
			v = fa[v][i];
		}
	}
	return fa[u][0];
}

int main() {
	//freopen("sep2_1.in", "r", stdin);
	//freopen("sep2_1.ans", "w", stdout);
	memset(l, -1, sizeof(l));
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; i++) {
		int u, v; scanf("%d%d", &u, &v);
		addEdge(u, v, i);
		e_u[i] = u, e_v[i] = v;
	}
	for (int i = 1; i <= n; i++) if (!dfn[i]) tarjan(i);
	for (int i = 1; i <= m; i++) {
		int u = e_u[i], v = e_v[i];
		if (col[u] != col[v]) {
			G[col[u]].push_back(col[v]);
			Ed[col[u]][col[v]] ++;
		}
	}
	init_vis();
	for (int i = 1; i <= cnt; i++) dfs_buildtree(rt[i], 0);
	for (int i = 1; i <= n; i++) f[i] = i, st[i].push_back(i);
	for (int i = 1; i <= m; i++) {
		int u = e_u[i], v = e_v[i];
		if (col[u] == col[v]) {
			int x = lca(u, v);
			vec[x][v].push_back(i);
			if (x == v) q[col[u]].push(i);
		}
	}
	for (int i = 1; i <= cnt; i++) solve(i);
	init_vis();
	for (int i = 1; i <= cnt; i++) if (!vis[i]) dfs_calmx(i);
	for (int i = 1; i <= m; i++) {
		int u = e_u[i], v = e_v[i];
		if (col[u] != col[v]) {
			if (mx[col[u]][col[v]] > 1 || Ed[col[u]][col[v]] > 1) puts("diff");
			else puts("same");
		} else {
			if (!imp[i]) {
				puts("same");
			} else {
				ban_id = i;
				int t = check(u, v);
				if (t) puts("same");
				else puts("diff");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 42112