#include <bits/stdc++.h>
using namespace std;
int n, m;
int tot, fir[1010], nxt[200200], to[200200];
void addE(int u, int v) { nxt[++tot] = fir[u], fir[u] = tot, to[tot] = v; }
void dfs(int u, int mk, int *vis) {
  vis[u] = mk;
  for (int i = fir[u], v; i; i = nxt[i]) {
    v = to[i];
    if (vis[v]) continue;
    dfs(v, mk, vis);
  }
}
int vis[1010][1010], lch[1010], rch[1010], ans[1010], stk[1010], top;
int main() {
  cin >> n >> m;
  for (int i = 1, u, v; i <= m; ++i) scanf("%d%d", &u, &v), addE(u, v);
  for (int i = 1; i <= n; ++i) dfs(i, 1, vis[i]);
  for (int u = 1; u <= n; ++u) {
    memset(lch, 0, sizeof lch);
    memset(rch, 0, sizeof rch);
    top = 0;
    for (int i = fir[u]; i; i = nxt[i]) stk[++top] = to[i];
    for (int i = top, v; i >= 1; --i)
      if (!lch[v = stk[i]]) lch[u] = i, dfs(v, i, lch);
    for (int i = 1, v; i <= top; ++i)
      if (!rch[v = stk[i]]) rch[u] = i, dfs(v, i, rch);
    for (int i = fir[u], v; i; i = nxt[i]) {
      v = to[i];
      if (vis[v][u] == (lch[v] != rch[v])) ans[i] = 1;
    }
  }
  for (int i = 1; i <= m; ++i) puts(ans[i] ? "same" : "diff");
  return 0;
}
