#include <bits/stdc++.h>
using namespace std;
char buf[30000005], *p1 = buf - 1;
int read() {
  int w = 0;
  char c = *(++p1);
  while (!isdigit(c)) c = *(++p1);
  while (isdigit(c)) {
    w = (w << 3) + (w << 1) + c - '0';
    c = *(++p1);
  }
  return w;
}
struct edge {
  int k, next;
} e[400005];
struct ed {
  int x, y;
} E[200005];
int n, m, home[1005], cnt = -1, D, s[1005], top, id[1005], tot, dfn[1005],
                      mn[1005], cc;
bool ins[1005], vis[1005][1005], temp[1005];
void add(int x, int y) {
  cnt++;
  e[cnt].k = y;
  e[cnt].next = home[x];
  home[x] = cnt;
}
void tarjan(int k) {
  dfn[k] = mn[k] = ++cc;
  s[++top] = k;
  ins[k] = 1;
  for (int i = home[k]; ~i; i = e[i].next) {
    if (!dfn[e[i].k]) {
      tarjan(e[i].k);
      mn[k] = min(mn[k], mn[e[i].k]);
    } else if (ins[e[i].k])
      mn[k] = min(mn[k], mn[e[i].k]);
  }
  if (dfn[k] == mn[k]) {
    id[k] = ++tot;
    ins[k] = 0;
    while (s[top] != k) {
      id[s[top]] = tot;
      ins[s[top]] = 0;
      top--;
    }
    top--;
  }
}
int q[1005];
void bfs(int x) {
  int tou = 0, wei = 1, k;
  q[0] = x;
  vis[D][D] = vis[D][x] = 1;
  while (tou < wei) {
    k = q[tou++];
    for (int i = home[k]; ~i; i = e[i].next)
      if (!vis[D][e[i].k]) q[wei++] = e[i].k, vis[D][e[i].k] = 1;
  }
}
int main() {
  fread(buf, 1, sizeof(buf), stdin);
  memset(home, -1, sizeof(home));
  n = read();
  m = read();
  for (int i = 1, x, y; i <= m; i++) {
    x = read();
    y = read();
    add(x, y);
    E[i].x = x;
    E[i].y = y;
  }
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) cc = 0, tarjan(i);
  for (int i = 1; i <= n; i++) {
    D = i;
    top = 0;
    for (int p = home[i]; ~p; p = e[p].next) {
      s[++top] = e[p].k;
      if (vis[i][e[p].k]) continue;
      bfs(e[p].k);
      vis[i][e[p].k] = 0;
    }
    int mn = 1;
    for (int p = 1; p <= n; p++) {
      temp[p] = vis[i][p];
      if (!temp[p]) mn = p;
    }
    memset(vis[i], 0, sizeof(vis[i]));
    for (int p = top; p > mn; p--) {
      if (vis[i][s[p]]) continue;
      bfs(s[p]);
      vis[i][s[p]] = 0;
    }
    for (int p = 1; p <= n; p++) vis[i][p] |= temp[p];
  }
  for (int i = 1; i <= m; i++) {
    int x = E[i].x, y = E[i].y;
    if (id[x] == id[y]) {
      if (!vis[x][y])
        puts("diff");
      else
        puts("same");
    } else {
      if (vis[x][y])
        puts("diff");
      else
        puts("same");
    }
  }
  return 0;
}
