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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int MN = 1010;
const int MM = 200010;

int N, M;
int a[MM], b[MM];

vector<pii> g[MN];

bool no_need[MM];
bool vis[MN];
bool can[MN][MN];

void dfs(int v, int st) {
	vis[v] = 1;
	for (auto e : g[v]) {
		if (!vis[e.fi] && e.fi != st) {
			dfs(e.fi, st);
		} 
	}
}

int main() {
	scanf("%d%d", &N, &M);

	rep(i, M) {
		scanf("%d%d", &a[i], &b[i]);
		--a[i]; --b[i];
		g[a[i]].eb(b[i], i);
	}

	rep(i, N) {
		queue<int> que;
		can[i][i] = 1;
		que.push(i);

		while (!que.empty()) {
			int v = que.front(); que.pop();
			for (auto e : g[v]) {
				if (!can[i][e.fi]) {
					can[i][e.fi] = 1;
					que.push(e.fi);
				}
			}
		}
	}

	rep(i, N) {
		rep(t, 2) {
			memset(vis, 0, sizeof(vis));

			for (auto e : g[i]) {
				if (vis[e.fi]) {
					no_need[e.se] = true;
				} else {
					dfs(e.fi, i);
				}
			}
			reverse(ALL(g[i]));
		}
	}

	rep(i, M) {
		puts(no_need[i] == can[b[i]][a[i]] ? "same" : "diff");
	}

	return 0;
}