#include <bits/stdc++.h>
using namespace std;
bool bo[1010];
int n, m, mi[1010], ma[1010], bel[1010], sta[1010], tp, dfn[1010], low[1010], x,
    y, cnt, hd[1010], t[1010], tn;
struct node {
  int to, next, ans;
} e[200010];
void addedge(int x, int y) { e[++cnt] = (node){y, hd[x], 0}, hd[x] = cnt; }
void tarjan(int x) {
  dfn[x] = low[x] = (++cnt), sta[++tp] = x, bo[x] = 1;
  for (int i = hd[x]; i; i = e[i].next)
    if (!dfn[e[i].to])
      tarjan(e[i].to), low[x] = min(low[x], low[e[i].to]);
    else if (bo[e[i].to])
      low[x] = min(low[x], dfn[e[i].to]);
  if (dfn[x] == low[x]) {
    bel[x] = x;
    while (sta[tp] != x) bel[sta[tp]] = x, bo[sta[tp]] = 0, tp--;
    tp--, bo[x] = 0;
  }
}
void dfs(int x, int v) {
  mi[x] = v;
  for (int i = hd[x]; i; i = e[i].next)
    if (mi[e[i].to] == -1) dfs(e[i].to, v);
}
void Dfs(int x, int v) {
  ma[x] = v;
  for (int i = hd[x]; i; i = e[i].next)
    if (ma[e[i].to] == -1) Dfs(e[i].to, v);
}
int main() {
  scanf("%d%d", &n, &m), cnt = 0;
  for (int i = 1; i <= m; i++) scanf("%d%d", &x, &y), addedge(x, y);
  memset(bo, 0, sizeof(bo)), tp = cnt = 0;
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) tarjan(i);
  for (int i = 1; i <= n; i++) {
    tn = 0;
    for (int j = hd[i]; j; j = e[j].next) t[++tn] = e[j].to;
    for (int j = 1; j <= n; j++) mi[j] = ma[j] = -1;
    mi[i] = ma[i] = 0;
    for (int j = 1; j <= tn; j++)
      if (mi[t[j]] == -1) dfs(t[j], j);
    for (int j = tn; j; j--)
      if (ma[t[j]] == -1) Dfs(t[j], j);
    for (int j = hd[i]; j; j = e[j].next)
      e[j].ans = ((mi[e[j].to] != ma[e[j].to]) ^ (bel[i] == bel[e[j].to]));
  }
  for (int j = 1; j <= m; j++) puts(e[j].ans ? "diff" : "same");
  return 0;
}
