#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int f = 1, x = 0;
  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;
}
int stack[20];
inline void write(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (!x) {
    putchar('0');
    return;
  }
  int top = 0;
  while (x) stack[++top] = x % 10, x /= 10;
  while (top) putchar(stack[top--] + '0');
}
inline void pr1(int x) {
  write(x);
  putchar(' ');
}
inline void pr2(int x) {
  write(x);
  putchar('\n');
}
const int MAXN = 1005;
const int MAXM = 200005;
struct edge {
  int x, y, next;
} a[MAXM];
int len, last[MAXN];
void ins(int x, int y) {
  len++;
  a[len].x = x;
  a[len].y = y;
  a[len].next = last[x];
  last[x] = len;
}
int vi[MAXN][MAXN];
void dfs1(int x, int o) {
  if (vi[o][x]) return;
  vi[o][x] = 1;
  for (int k = last[x]; k; k = a[k].next) dfs1(a[k].y, o);
}
int bi[2][MAXN], tim;
void dfs2(int x, int o) {
  if (bi[o][x]) return;
  bi[o][x] = tim;
  for (int k = last[x]; k; k = a[k].next) dfs2(a[k].y, o);
}
int ans[MAXM], sta[MAXM], tp;
int n, m;
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= m; i++) {
    int x = read(), y = read();
    ins(x, y);
  }
  for (int i = 1; i <= n; i++) dfs1(i, i);
  for (int i = 1; i <= n; i++) {
    tp = 0;
    memset(bi, 0, sizeof(bi));
    bi[0][i] = bi[1][i] = 1;
    for (int k = last[i], lst = 1; k; k = a[k].next, lst++) {
      sta[++tp] = k;
      tim = lst;
      dfs2(a[k].y, 0);
    }
    sta[tp + 1] = 0;
    while (tp) {
      if (sta[tp + 1]) dfs2(a[sta[tp + 1]].y, 1);
      int y = a[sta[tp]].y;
      if (vi[y][i] == (bi[1][y] || (bi[0][y] < tp && bi[0][y])))
        ans[sta[tp]] = 1;
      tp--;
    }
  }
  for (int i = 1; i <= m; i++) {
    if (ans[i])
      puts("same");
    else
      puts("diff");
  }
  return 0;
}
