#include <bits/stdc++.h>
using namespace std;

const int N = 1010;
const int M = 200005;
const int INF = 1e9;

int n, m;
int fr[M], to[M];
vector<int> g[N];
int low[N], num[N], step, scc;
stack <int> st;
int pos[N];
int vis[N];
bool curvis[N];
bool two[N][N];

void dfs(int u) {
	low[u] = num[u] = ++step;
	st.push(u);

	for (int &v : g[u]) {
		if (num[v]) low[u] = min(low[u], num[v]);
		else {
			dfs(v);
			low[u] = min(low[u], low[v]);
		}
	}

	if (low[u] == num[u]) {
		int v = 0;
		++scc;
		do {
			v = st.top(); st.pop();
			low[v] = num[v] = INF;
			pos[v] = scc;
		} while(v != u);
	}
}

vector<int> current;

void dfs2(int u) {
	vis[u]++;
	current.push_back(u);
	curvis[u] = true;

	for (int &v : g[u]) {
		if (curvis[v]) continue;
		if (vis[v] == 2) continue;
		dfs2(v);
	}
}

void solve(int s) {
	for (int i = 1; i <= n; ++i) vis[i] = 0;
	vis[s] = 2;
	
	for (int &v : g[s]) {
		current.clear();
		if (vis[v] < 2) dfs2(v);
		while(current.size()) {
			curvis[current.back()] = false;
			current.pop_back();
		}
	}

	for (int i = 1; i <= n; ++i) if (vis[i] == 2) two[s][i] = true;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		int u, v; cin >> u >> v;
		g[u].push_back(v);
		fr[i] = u;
		to[i] = v;
	}

	for (int i = 1; i <= n; ++i) if (!num[i]) dfs(i);

	for (int i = 1; i <= n; ++i) {
		solve(i);
	}

	for (int i = 0; i < m; ++i) {
		int u = fr[i], v = to[i];
		bool cur = (pos[u] != pos[v]);
		cur ^= two[u][v];
		
		// cut the i-th edge and check if there exists a directed path from u to v
		if (cur) {
			printf("same\n");
		} else {
			printf("diff\n");
		}
	}
}