#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1010, Maxm = 200010;
const int inf = 2147483647;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  return x * f;
}
template <typename T>
void cmin(T& x, T y) {
  x = min(x, y);
}
template <typename T>
void cmax(T& x, T y) {
  x = max(x, y);
}
int n, m;
struct Edge {
  int y, next;
};
struct Graph {
  Edge e[Maxm];
  int last[Maxn], len;
  int cnt[Maxn][Maxn];
  bool vis[Maxn];
  bitset<Maxn> S[Maxn];
  void init() { len = 0; }
  void ins(int x, int y) {
    int t = ++len;
    e[t].y = y;
    e[t].next = last[x];
    last[x] = t;
  }
  void bfs(int p) {
    queue<int> q;
    q.push(p);
    memset(vis, false, sizeof(vis));
    vis[p] = true;
    for (int i = 1; i <= n; i++) S[i].reset(), S[i].set(i);
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      for (int i = last[x]; i; i = e[i].next) {
        int y = e[i].y;
        if (!S[x][y]) cnt[p][y]++;
        if (!vis[y]) {
          S[y] |= S[x];
          vis[y] = true;
          q.push(y);
        }
      }
    }
  }
} G1, G2;
int low[Maxn], dfn[Maxn], sta[Maxn], top = 0, id = 0, cnt = 0, bel[Maxn];
bool in[Maxn];
void Tarjan(int x) {
  low[x] = dfn[x] = ++id;
  sta[++top] = x;
  in[x] = true;
  for (int i = G1.last[x]; i; i = G1.e[i].next) {
    int y = G1.e[i].y;
    if (!dfn[y])
      Tarjan(y), low[x] = min(low[x], low[y]);
    else if (in[y])
      low[x] = min(low[x], dfn[y]);
  }
  if (low[x] == dfn[x]) {
    int i;
    cnt++;
    do {
      i = sta[top--];
      in[i] = false;
      bel[i] = cnt;
    } while (i != x);
  }
}
int ex[Maxm], ey[Maxm];
int main() {
  n = read(), m = read();
  G1.init(), G2.init();
  for (int i = 1; i <= m; i++) {
    ex[i] = read(), ey[i] = read();
    G1.ins(ex[i], ey[i]);
  }
  for (int i = 1; i <= n; i++) G1.bfs(i);
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) Tarjan(i);
  for (int i = 1; i <= m; i++)
    if (bel[ex[i]] != bel[ey[i]]) G2.ins(bel[ex[i]], bel[ey[i]]);
  for (int i = 1; i <= cnt; i++) G2.bfs(i);
  for (int i = 1; i <= m; i++) {
    int x = ex[i], y = ey[i];
    if (bel[x] == bel[y]) {
      if (G1.cnt[x][y] > 1)
        puts("same");
      else
        puts("diff");
    } else {
      if (G2.cnt[bel[x]][bel[y]] > 1)
        puts("diff");
      else
        puts("same");
    }
  }
}
