#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
vector<int> v[1000 + 5], w[1000 + 5], V[1000 + 5], W[1000 + 5];
int n, m, bel[1000 + 5], head[1000 + 5], cnt, Ans[200000 + 5], q[1000 + 5], cc,
    in[1000 + 5], now;
int top, dfn[1000 + 5], low[1000 + 5], c[1000 + 5], num, dn, inq[1000 + 5],
    mx[1000 + 5], mn[1000 + 5], f[1000 + 5];
struct edge {
  int to, next, w;
} e[1000 + 5];
inline void ins(int f, int t, int w) {
  e[++cnt] = (edge){t, head[f], w};
  head[f] = cnt;
}
void MarkMn(int x, int c) {
  mn[x] = c;
  for (int i = 0; i < v[x].size(); ++i)
    if (!(x == now && i + 1 > c) && mn[v[x][i]] == n) MarkMn(v[x][i], c);
}
void MarkMx(int x, int c) {
  mx[x] = c;
  for (int i = 0; i < v[x].size(); ++i)
    if (!(x == now && i + 1 < c) && !mx[v[x][i]]) MarkMx(v[x][i], c);
}
void Solve() {
  for (int i = 1; i <= num; ++i)
    for (int j = head[c[i]]; j; j = e[j].next)
      if (bel[e[j].to] == cc)
        v[c[i]].push_back(e[j].to), w[c[i]].push_back(e[j].w);
  for (int i = 1; i <= num; ++i) {
    for (int j = 1; j <= num; ++j) mx[c[j]] = 0, mn[c[j]] = n;
    now = c[i];
    for (int j = 0; j < v[c[i]].size(); ++j)
      if (mn[v[c[i]][j]] == n) MarkMn(v[c[i]][j], j + 1);
    for (int j = v[c[i]].size() - 1; ~j; --j)
      if (!mx[v[c[i]][j]]) MarkMx(v[c[i]][j], j + 1);
    for (int j = 1; j <= num; ++j)
      if (i != j && mn[c[j]] == mx[c[j]]) Ans[w[c[i]][mn[c[j]] - 1]] = 1;
  }
}
void Tarjan(int x) {
  dfn[x] = low[x] = ++dn;
  q[++top] = x;
  inq[x] = 1;
  for (int i = head[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 (inq[e[i].to])
      low[x] = min(low[x], dfn[e[i].to]);
  if (dfn[x] == low[x]) {
    for (num = 0, ++cc; q[top + 1] != x; inq[q[top--]] = 0)
      c[++num] = q[top], bel[q[top]] = cc;
    Solve();
  }
}
inline void R(int& x, int y) { x = min(2, x + y); }
int main() {
  n = read();
  m = read();
  for (int i = 1, j; i <= m; ++i) j = read(), ins(j, read(), i);
  for (int i = 1; i <= n; ++i)
    if (!dfn[i]) Tarjan(i);
  for (int i = 1; i <= n; ++i)
    for (int j = head[i]; j; j = e[j].next)
      if (bel[i] != bel[e[j].to])
        V[bel[i]].push_back(bel[e[j].to]), W[bel[i]].push_back(e[j].w);
  for (int i = 1; i <= cc; ++i) {
    memset(f, 0, sizeof(f));
    memset(in, 0, sizeof(in));
    for (int j = 1; j <= cc; ++j)
      for (int k = 0; k < V[j].size(); ++k) ++in[V[j][k]];
    f[i] = 1;
    q[top = 1] = i;
    for (int j = 1; j <= top; ++j)
      for (int k = 0; k < V[q[j]].size(); ++k)
        if (R(f[V[q[j]][k]], f[q[j]]), !--in[V[q[j]][k]]) q[++top] = V[q[j]][k];
    for (int j = 0; j < V[i].size(); ++j)
      if (f[V[i][j]] != 1) Ans[W[i][j]] = 1;
  }
  for (int i = 1; i <= m; ++i) puts(Ans[i] ? "diff" : "same");
  return 0;
}
