#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
typedef pair<int, int> P;
bool can[1000][1000];
bool ans[200000];
bool reach[200000];
vector<P> G[200000];
bool vis[1000];
void dfs(int s, int v) {
	can[s][v] = 1;
	for (P e : G[v]) {
		if (!can[s][e.first]) {
			dfs(s, e.first);
		}
	}
}
void dfs2(int v) {
	vis[v] = 1;
	for (P e : G[v]) {
		if (!vis[e.first]) {
			dfs2(e.first);
		}
	}
}
int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].emplace_back(b, i);
	}
	for (int i = 0; i < N; i++) dfs(i, i);
	for (int i = 0; i < N; i++) {
		vector<P> edge = G[i];
		G[i].clear();
		memset(vis, 0, sizeof(vis));
		for (P e : edge) {
			if (vis[e.first]) reach[e.second] = 1;
			G[i].push_back(e);
			dfs2(i);
		}
		reverse(edge.begin(), edge.end());
		G[i].clear();
		memset(vis, 0, sizeof(vis));
		for (P e : edge) {
			if (vis[e.first]) reach[e.second] = 1;
			G[i].push_back(e);
			dfs2(i);
		}
		for (P e : edge) {
			if (can[e.first][i] == reach[e.second]) ans[e.second] = 1;
		}
	}
	for (int i = 0; i < M; i++) {
		if (ans[i]) cout << "same" << endl;
		else cout << "diff" << endl;
	}
}