#include <bits/stdc++.h>

const int MAXN = 1010;
typedef std::vector<int> VI;
typedef std::pair<int, int> pi;
VI out[MAXN], rout[MAXN], ine[MAXN];
int n, m;
int * ind; VI * so;
void dfs(int t) { for (auto i : so[t]) if (!ind[i]) ind[i] = t, dfs(i); }
std::map<pi, int> u2v, v2u;
int xs[200010], ys[200010];

int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n >> m;
	for (int i = 1; i <= m; ++i) {
		std::cin >> xs[i] >> ys[i];
		out[xs[i]].push_back(ys[i]);
		ine[ys[i]].push_back(xs[i]);
	}
	for (int i = 1; i <= n; ++i) {
		std::sort(out[i].begin(), out[i].end());
		rout[i].assign(out[i].rbegin(), out[i].rend());
	}
	static int i1[MAXN], i2[MAXN];
	for (int i = 1; i <= n; ++i) {
		memset(i1, 0, n + 1 << 2);
		memset(i2, 0, n + 1 << 2);
		so = out,  ind = i1, i1[i] = n + 1; dfs(i);
		so = rout, ind = i2, i2[i] = n + 1; dfs(i);
		for (auto t : ine[i]) if (i1[t]) v2u[pi(t, i)] = true;
		for (auto t : out[i])
			if (i1[t] != i2[t] || i1[t] != i)
				u2v[pi(i, t)] = true;
	}
	for (int i = 1; i <= m; ++i) {
		auto t = pi(xs[i], ys[i]);
		std::cout << (u2v[t] ^ v2u[t] ? "diff\n" : "same\n");
	}
	return 0;
}
