#include <bits/stdc++.h>
using namespace std;
const int N = 1005, M = 2e5 + 5;
int n, m;
struct st {
  int from, nxt, to, ans;
} ed[M];
int head[N], num;
void add(int from, int to) {
  ed[++num].to = to, ed[num].from = from;
  ed[num].nxt = head[from];
  head[from] = num;
}
int stk[N], top, dfn[N], low[N], refl[N], t, numb;
bool cn[N];
void tarjan(int x) {
  dfn[x] = low[x] = ++numb, stk[++top] = x, cn[x] = 1;
  for (int u, i = head[x]; i; i = ed[i].nxt) {
    u = ed[i].to;
    if (!dfn[u])
      tarjan(u), low[x] = min(low[x], low[u]);
    else if (cn[u])
      low[x] = min(low[x], dfn[u]);
  }
  if (dfn[x] == low[x]) {
    ++t;
    while (stk[top] != x) refl[stk[top]] = t, cn[stk[top]] = 0, --top;
    refl[stk[top]] = t, cn[stk[top]] = 0, --top;
  }
}
int fir[2][N];
void dfs(int x, int id, int typ) {
  if (fir[typ][x]) return;
  fir[typ][x] = id;
  for (int u, i = head[x]; i; i = ed[i].nxt) {
    u = ed[i].to;
    if (!fir[typ][u]) dfs(u, id, typ);
  }
}
int E[M], tot;
int main() {
  int u, v;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) scanf("%d%d", &u, &v), add(u, v);
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) tarjan(i);
  for (int i = 1; i <= m; i++)
    if (refl[ed[i].to] == refl[ed[i].from]) ed[i].ans = 1;
  for (int x = 1; x <= n; x++) {
    for (int i = 1; i <= n; i++) fir[0][i] = fir[1][i] = 0;
    fir[0][x] = fir[1][x] = 1, tot = 0;
    for (int i = head[x]; i; i = ed[i].nxt) E[++tot] = i;
    for (int i = 1; i <= tot; i++) dfs(ed[E[i]].to, E[i], 0);
    for (int i = tot; i; i--) dfs(ed[E[i]].to, E[i], 1);
    for (int i = head[x]; i; i = ed[i].nxt)
      if (fir[0][ed[i].to] != i || fir[1][ed[i].to] != i) ed[i].ans++;
  }
  for (int i = 1; i <= m; i++)
    if (ed[i].ans == 1)
      printf("diff\n");
    else
      printf("same\n");
  return 0;
}
