#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <cstring>
#include <iostream>
#include <algorithm>

#define fi first
#define se second
#define pb push_back
#define MP std::make_pair
#define PII std::pair<int, int>
#define all(x) (x).begin(), (x).end()
#define CL(a, b) memset(a, b, sizeof a)
#define rep(i, l, r) for (int i = (l); i <= (r); ++ i)
#define per(i, r, l) for (int i = (r); i >= (l); -- i)
#define PE(x, a) for (int x = head[a]; x;x = edge[x].next)

typedef long long ll;

const int MAXN = 1e3 + 7;
const int MAXM = 2e5 + 7;

int n, m;
std::vector<PII> E[MAXN];
int fr[MAXM], to[MAXM], col[MAXN][MAXN][2], vis[MAXN], ts;

void dfs(int u, int root, int c, int type) {
	vis[u] = ts, col[root][u][type] = c;
	for (auto v: E[u]) if (vis[v.fi] != ts) dfs(v.fi, root, c, type);
}

void solve(int u) {
	vis[u] = ++ts;
	for (auto v: E[u]) if (vis[v.fi] != ts) dfs(v.fi, u, v.se, 0);
	std::reverse(all(E[u]));
	vis[u] = ++ts;
	for (auto v: E[u]) if (vis[v.fi] != ts) dfs(v.fi, u, v.se, 1);
}

int main() {
	scanf("%d %d", &n, &m);
	rep(i, 1, m) scanf("%d %d", fr + i, to + i), E[fr[i]].pb(MP(to[i], i));
	rep(i, 1, n) solve(i);
	rep(i, 1, m) {
		if ((col[to[i]][fr[i]][0] != 0) == (col[fr[i]][to[i]][0] != i || col[fr[i]][to[i]][1] != i)) printf("same\n");
		else printf("diff\n");
	}
	return 0;
}