#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    ;
  for (x = c - '0'; (c = getchar()) >= '0' && c <= '9';) x = x * 10 + c - '0';
  return x;
}
struct edge {
  int nx, t;
} e[200000 * 3 + 5];
int h[1000 + 5], r[1000 + 5], c[1000 + 5], en = 1, x[200000 + 5], y[200000 + 5];
int d[1000 + 5], l[1000 + 5], cnt, z[1000 + 5], zn, inz[1000 + 5], p[1000 + 5],
    pn;
int g[1000 + 5][1000 + 5], q[1000 + 5], qn, u[1000 + 5], uu[200000 + 5];
inline void ins(int* h, int x, int y) {
  e[++en] = (edge){h[x], y};
  h[x] = en;
}
void dfs(int x) {
  d[x] = l[x] = ++cnt;
  inz[z[zn++] = x] = 1;
  for (int i = h[x]; i; i = e[i].nx)
    if (!d[e[i].t])
      dfs(e[i].t), l[x] = min(l[x], l[e[i].t]);
    else if (inz[e[i].t])
      l[x] = min(l[x], d[e[i].t]);
  if (d[x] == l[x])
    for (++pn; z[zn] != x;) inz[z[--zn]] = 0, p[z[zn]] = pn;
}
void d1(int* h, int x, int z) {
  u[x] = 1;
  for (int i = h[x]; i; i = e[i].nx)
    if (p[e[i].t] == p[x] && !u[e[i].t]) d1(h, e[i].t, z), uu[i >> 1] |= z;
}
void d2(int* h, int x, int d, int xs, int ys) {
  u[x] = 1;
  for (int i = h[x]; i; i = e[i].nx)
    if (p[e[i].t] == p[x] && (i >> 1) != d && !u[e[i].t])
      d2(h, e[i].t, d, xs, ys);
  if (x == xs && !u[ys]) d2(h, ys, d, xs, ys);
}
int main() {
  int n = read(), m = read(), i, j, k;
  for (i = 1; i <= m; ++i)
    x[i] = read(), y[i] = read(), ins(h, x[i], y[i]), ins(r, y[i], x[i]);
  for (i = 1; i <= n; ++i)
    if (!d[i]) dfs(i);
  for (i = 1; i <= n; ++i)
    if (!u[i]) d1(h, i, 1);
  memset(u, 0, sizeof(u));
  for (i = 1; i <= n; ++i)
    if (!u[i]) d1(r, i, 2);
  for (i = 1; i <= m; ++i)
    if (p[x[i]] != p[y[i]]) ins(c, p[x[i]], p[y[i]]);
  for (i = 1; i <= pn; ++i)
    for (g[i][q[j = qn = 1] = i] = 1; j <= qn; ++j)
      for (k = c[q[j]]; k; k = e[k].nx)
        if (!g[i][e[k].t]++) q[++qn] = e[k].t;
  for (i = 1; i <= m; ++i)
    if (p[x[i]] != p[y[i]])
      puts(g[p[x[i]]][p[y[i]]] > 1 ? "diff" : "same");
    else {
      if (uu[i]) {
        memset(u, 0, sizeof(u));
        d2(h, x[i], i, y[i], x[i]);
        for (j = 1; j <= n; ++j)
          if (p[j] == p[x[i]] && !u[j]) break;
        if (j <= n) {
          puts("diff");
          continue;
        }
      }
      if (uu[i]) {
        memset(u, 0, sizeof(u));
        d2(r, x[i], i, x[i], y[i]);
        for (j = 1; j <= n; ++j)
          if (p[j] == p[x[i]] && !u[j]) break;
        if (j <= n) {
          puts("diff");
          continue;
        }
      }
      puts("same");
    }
}
