// u -> v same: ban u -> v, u is reachable from v ^ vice versa = 0
// Problem : F - Two Faced Edges
// Contest : AtCoder Regular Contest 092
// URL : https://atcoder.jp/contests/arc092/tasks/arc092_d
// Memory Limit : 256 MB
// Time Limit : 5000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define cerr if(1)cerr
#define size(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define sort(a, n) sort(a + 1, a + n + 1)
#define temptts template <class T, class... Ts>

const int N = 1001, M = 2e5 + 2, mod = 1e9 + 7, inf = 2e9;

struct edge_list {
	int u, v;
} edge[M];

bool vis[N];
vector<int> adj[N], radj[N];
int n, m, ban, ans[M], cur[M];

void dfs(int v) {
	vis[v] = 1;
	for (auto id : adj[v]) {
		int u = edge[id].v;
		if (u == ban || vis[u]) continue;
		dfs(u);
	}
}

int main() { cin.tie(0)->sync_with_stdio(0);
	cin >> n >> m;
	for (int i = 1, u, v; i <= m; i++) {
		cin >> u >> v;
		edge[i] = {u, v};
		adj[u].push_back(i);
		radj[v].push_back(i);
	}
	for (int i = 1; i <= n; i++) {
		memset(vis, 0, sizeof vis);
		ban = 0;
		dfs(i);
		for (auto id : radj[i]) {
			ans[id] ^= vis[edge[id].u];
		}
		ban = i;
		memset(vis, 0, sizeof vis);
		for (auto id : adj[i]) {
			int u = edge[id].v;
			cur[id] |= vis[u];
			dfs(u);
		}
		memset(vis, 0, sizeof vis);
		for (int k = size(adj[i]) - 1; k >= 0; k--) {
			int id = adj[i][k], u = edge[id].v;
			ans[id] ^= cur[id] | vis[u];
			dfs(u);
		}
	}
	for (int i = 1; i <= m; i++) {
		puts(ans[i] ? "diff" : "same");
	}
}
