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

const int MAXN = 1010;
const int MAXM = 2.1e5;
int N, M;
int A[MAXM];
int B[MAXM];
vector<int> adj[MAXN];

bool reach[MAXN][MAXN];

bool vis[MAXN];
bool bad[MAXN][MAXN];

int main() {
	ios::sync_with_stdio(0), cin.tie(0);

	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> A[i] >> B[i]; A[i]--, B[i]--;
		adj[A[i]].push_back(B[i]);
	}

	// 1. reach[][]
	{
		for (int st = 0; st < N; st++) {
			function<void(int)> dfs = [&](int cur) -> void {
				if (reach[st][cur]) return;
				reach[st][cur] = true;
				for (int nxt : adj[cur]) {
					dfs(nxt);
				}
			};
			dfs(st);
		}
	}

	// 2. bad[][]
	{
		for (int st = 0; st < N; st++) {
			function<void(int)> dfs = [&](int cur) -> void {
				if (st == cur) return;
				if (vis[cur]) return;
				vis[cur] = true;
				for (int nxt : adj[cur]) {
					dfs(nxt);
				}
			};

			for (int z = 0; z < 2; z++) {
				fill(vis, vis+N, false);
				for (int nxt : adj[st]) {
					if (vis[nxt]) {
						bad[st][nxt] = true;
					} else {
						dfs(nxt);
					}
				}
				reverse(adj[st].begin(), adj[st].end());
			}
		}
	}

	for (int i = 0; i < M; i++) {
		int a = A[i], b = B[i];
		if (reach[b][a] == bad[a][b]) {
			cout << "same" << '\n';
		} else {
			cout << "diff" << '\n';
		}
	}

	return 0;
}
