#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;
}
bitset<MAXN> bi[MAXM + MAXN], bnow;
void dfs(int x, int o) {
  if (bi[o][x]) return;
  bi[o][x] = 1;
  for (int k = last[x]; k; k = a[k].next) dfs(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++) dfs(i, m + i);
  for (int i = 1; i <= n; i++) {
    tp = 0;
    for (int k = last[i], lst = 1; k; k = a[k].next, lst++) {
      sta[++tp] = k;
      bi[lst] = bi[lst - 1];
      bi[lst][i] = 1;
      dfs(a[k].y, lst);
    }
    sta[tp + 1] = 0;
    bi[m + n + 1].reset();
    bi[m + n + 1][i] = 1;
    while (tp) {
      if (sta[tp + 1]) dfs(a[sta[tp + 1]].y, m + n + 1);
      bnow = bi[m + n + 1] | bi[tp - 1];
      int y = a[sta[tp]].y;
      if (bi[m + y][i] == bnow[y]) ans[sta[tp]] = 1;
      tp--;
    }
  }
  for (int i = 1; i <= m; i++) {
    if (ans[i])
      puts("same");
    else
      puts("diff");
  }
  return 0;
}
