#include <bits/stdc++.h>
using namespace std;
template <typename tp>
inline void read(tp& x) {
  x = 0;
  char tmp;
  bool key = 0;
  for (tmp = getchar(); !isdigit(tmp); tmp = getchar()) key = (tmp == '-');
  for (; isdigit(tmp); tmp = getchar()) x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x, tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x, tp y) {
  x = x < y ? y : x;
}
const int N = 1010, M = 200010;
int n, m;
pair<int, int> edg[M];
struct edge {
  int la, b;
} con[M];
int tot, first[N];
void add_edge(int from, int to) {
  con[++tot] = (edge){first[from], to};
  first[from] = tot;
}
int sta[N], dfn[N], low[N], top, bcnt, col[N];
void dfs(int pos) {
  sta[dfn[pos] = low[pos] = ++top] = pos;
  for (int i = first[pos]; i; i = con[i].la) {
    if (col[con[i].b]) continue;
    if (!dfn[con[i].b]) dfs(con[i].b);
    low[pos] = min(low[pos], low[con[i].b]);
  }
  if (low[pos] >= dfn[pos]) {
    ++bcnt;
    while (top >= dfn[pos]) col[sta[top--]] = bcnt;
  }
}
int ava[M], rec[N], rt;
void fsd(int pos) {
  for (int i = first[pos]; i; i = con[i].la) {
    if (con[i].b == rt || rec[con[i].b] > 0) continue;
    rec[con[i].b] = 1;
    fsd(con[i].b);
  }
}
void doit(int cur) {
  rt = cur;
  memset(rec, 0, sizeof rec);
  vector<int> tmp;
  for (int i = first[cur]; i; i = con[i].la) {
    if (rec[con[i].b] == 0) {
      rec[con[i].b] = 1;
      fsd(con[i].b);
    } else
      ava[i] = 1;
    tmp.push_back(i);
  }
  memset(rec, 0, sizeof rec);
  reverse(tmp.begin(), tmp.end());
  for (int j = 0; j < (int)tmp.size(); ++j) {
    int i = tmp[j];
    if (rec[con[i].b] == 0) {
      rec[con[i].b] = 1;
      fsd(con[i].b);
    } else
      ava[i] = 1;
  }
}
bool check(int a, int b) { return ((a ^ b) == 0) ? 0 : 1; }
int main() {
  int x, y;
  read(n), read(m);
  for (int i = (1); i <= (m); ++i) {
    read(x), read(y);
    edg[i] = pair<int, int>(x, y);
    add_edge(x, y);
  }
  for (int i = (1); i <= (n); ++i)
    if (!dfn[i]) dfs(i);
  for (int i = (1); i <= (n); ++i) doit(i);
  for (int i = (1); i <= (m); ++i)
    printf("%s\n", check(ava[i], col[edg[i].first] == col[edg[i].second])
                       ? "diff"
                       : "same");
  return 0;
}
