#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T &res) {
  res = 0;
  char c = getchar();
  T f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    res = res * 10 + c - '0';
    c = getchar();
  }
  res *= f;
}
template <class T>
void out(T x) {
  if (x < 0) {
    x = -x;
    putchar('-');
  }
  if (x >= 10) {
    out(x / 10);
  }
  putchar('0' + x % 10);
}
struct node {
  int to, next, id;
} E[200005];
int head[1005], sumE, M, N, a[200005], b[200005];
bool a1[200005], a2[200005], mark[1005];
int low[1005], dfn[1005], idx, sta[1005], top, instack[1005], col[1005], tot,
    cnt;
bitset<1005> reachable[1005];
vector<int> L[1005], v;
void add(int u, int v, int id) {
  E[++sumE].to = v;
  E[sumE].next = head[u];
  E[sumE].id = id;
  head[u] = sumE;
}
void Tarjan(int u) {
  dfn[u] = low[u] = ++idx;
  sta[++top] = u;
  instack[u] = 1;
  for (int i = head[u]; i; i = E[i].next) {
    int v = E[i].to;
    if (!dfn[v]) {
      Tarjan(v);
      low[u] = min(low[v], low[u]);
    } else if (instack[v] == 1)
      low[u] = min(low[u], dfn[v]);
  }
  if (low[u] == dfn[u]) {
    ++tot;
    while (1) {
      int x = sta[top--];
      col[x] = tot;
      L[tot].push_back(x);
      instack[x] = 2;
      if (x == u) break;
    }
    int s = L[tot].size();
    for (int i = 0; i < s; ++i) {
      for (int j = 0; j < s; ++j) {
        reachable[L[tot][i]][L[tot][j]] = 1;
      }
    }
  }
}
void dfs(int u) {
  if (mark[u]) return;
  mark[u] = 1;
  for (int i = head[u]; i; i = E[i].next) {
    int v = E[i].to;
    if (!mark[v]) dfs(v);
  }
}
void Solve() {
  read(N);
  read(M);
  for (int i = 1; i <= M; ++i) {
    read(a[i]);
    read(b[i]);
    add(a[i], b[i], i);
  }
  for (int i = 1; i <= N; ++i) {
    if (!dfn[i]) Tarjan(i);
  }
  for (int i = 1; i <= tot; ++i) {
    int s = L[i][0];
    for (auto k : L[i]) {
      for (int j = head[k]; j; j = E[j].next) {
        int v = E[j].to;
        if (col[v] != i) reachable[s] |= reachable[v];
      }
    }
    for (auto k : L[i]) {
      if (k != s) reachable[k] |= reachable[s];
    }
  }
  for (int u = 1; u <= N; ++u) {
    v.clear();
    for (int i = head[u]; i; i = E[i].next) {
      v.push_back(E[i].id);
    }
    memset(mark, 0, sizeof(mark));
    mark[u] = 1;
    int s = v.size();
    for (int i = 0; i < s; ++i) {
      a2[v[i]] |= mark[b[v[i]]];
      dfs(b[v[i]]);
    }
    memset(mark, 0, sizeof(mark));
    mark[u] = 1;
    for (int i = s - 1; i >= 0; --i) {
      a2[v[i]] |= mark[b[v[i]]];
      dfs(b[v[i]]);
    }
  }
  for (int i = 1; i <= M; ++i) {
    if (reachable[b[i]][a[i]]) a1[i] = 1;
    if (a1[i] ^ a2[i])
      puts("diff");
    else
      puts("same");
  }
}
int main() {
  Solve();
  return 0;
}
