#include <bits/stdc++.h>
const int N = 1005;
const int M = 2e5 + 5;
int n, m;
bool irp[M], lnk[N][N];
namespace utils {
template <class T>
inline void apn(T &x, const T y) {
  x = x < y ? x : y;
}
template <class T>
inline void apx(T &x, const T y) {
  x = x > y ? x : y;
}
inline int nxi() {
  int x = 0;
  char c;
  while (((c = getchar()) > '9' || c < '0') && c != '-')
    ;
  const bool f = c == '-' && (c = getchar());
  while (x = x * 10 - 48 + c, (c = getchar()) >= '0' && c <= '9')
    ;
  return f ? -x : x;
}
}  // namespace utils
using namespace utils;
namespace G {
int rt, cnt, fir[N], col[N];
struct edge {
  int fr, to, nx;
} eg[M];
inline void add(const int a, const int b) {
  eg[++cnt] = (edge){a, b, fir[a]};
  fir[a] = cnt;
}
void dfs(const int x, const int c) {
  if (col[x]) return;
  lnk[rt][x] = 1;
  col[x] = c;
  for (int i = fir[x]; i; i = eg[i].nx) {
    dfs(eg[i].to, c);
  }
}
void getrep(const int x) {
  for (int i = fir[x], j = 1; i; i = eg[i].nx, ++j) {
    irp[i] |= col[eg[i].to] != j;
  }
}
void set(const int x) {
  static int buk[N];
  int cnt = 0;
  rt = x;
  for (int i = fir[x]; i; i = eg[i].nx) {
    buk[++cnt] = eg[i].to;
  }
  memset(col + 1, 0, n * sizeof(col[0]));
  col[x] = -1;
  for (int i = 1; i <= cnt; ++i) {
    dfs(buk[i], i);
  }
  getrep(x);
  memset(col + 1, 0, n * sizeof(col[0]));
  col[x] = -1;
  for (int i = cnt; i >= 1; --i) {
    dfs(buk[i], i);
  }
  getrep(x);
}
}  // namespace G
int main() {
  n = nxi(), m = nxi();
  for (int i = 1; i <= m; ++i) {
    const int a = nxi(), b = nxi();
    G::add(a, b);
  }
  for (int i = 1; i <= n; ++i) {
    G::set(i);
  }
  for (int i = 1; i <= m; ++i) {
    puts(irp[i] ^ lnk[G::eg[i].to][G::eg[i].fr] ? "diff" : "same");
  }
  return 0;
}
