#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
inline void chmin(A &a, B b) {
  if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b) {
  if (a < b) a = b;
}
namespace SCC {
void visit(const vector<vector<long long>> &G, vector<long long> &vs,
           vector<long long> &used, long long v) {
  used[v] = true;
  for (auto u : G[v]) {
    if (!used[u]) visit(G, vs, used, u);
  }
  vs.push_back(v);
}
void visit2(const vector<vector<long long>> &T, vector<long long> &used,
            vector<long long> &comp, vector<long long> &vec, long long k,
            long long v) {
  comp[v] = k;
  used[v] = true;
  vec.push_back(v);
  for (auto u : T[v]) {
    if (!used[u]) visit2(T, used, comp, vec, k, u);
  }
}
void decompose(const vector<vector<long long>> &G, vector<vector<long long>> &H,
               vector<long long> &comp) {
  vector<vector<long long>> T(G.size());
  for (long long i = 0; i < G.size(); i++) {
    for (auto v : G[i]) {
      T[v].push_back(i);
    }
  }
  comp.resize(G.size());
  vector<long long> vs(G.size());
  vector<long long> used(G.size());
  for (long long i = 0; i < G.size(); i++) {
    if (!used[i]) visit(G, vs, used, i);
  }
  reverse(vs.begin(), vs.end());
  fill(used.begin(), used.end(), 0);
  long long K = 0;
  vector<vector<long long>> S;
  for (auto v : vs) {
    if (!used[v]) {
      S.push_back(vector<long long>());
      visit2(T, used, comp, S.back(), K++, v);
    }
  }
  H.resize(K);
  fill(used.begin(), used.end(), 0);
  for (long long i = 0; i < K; i++) {
    for (auto v : S[i]) {
      for (auto u : G[v]) {
        if (used[comp[u]] || comp[v] == comp[u]) continue;
        used[comp[u]] = true;
        H[comp[v]].push_back(comp[u]);
      }
    }
    for (auto v : H[i]) used[v] = false;
  }
}
}  // namespace SCC
long long N, M;
long long A[222222], B[222222];
bool ans[222222];
vector<vector<long long>> g;
vector<vector<long long>> rg;
vector<long long> comp;
bool mark[2222];
long long semi[2222];
void dfs(long long v, long long second) {
  semi[v] = second;
  for (auto u : g[v]) {
    if (comp[v] != comp[u]) continue;
    if (semi[u] != -1) continue;
    if (second == -5)
      dfs(u, u);
    else
      dfs(u, second);
  }
}
bool re[2222];
void dfs2(long long v) {
  re[v] = true;
  for (auto u : rg[v]) {
    if (semi[v] != semi[u]) continue;
    if (re[u]) continue;
    dfs2(u);
  }
}
signed main() {
  scanf("%lld%lld", &N, &M);
  g.resize(N);
  rg.resize(N);
  for (long long i = 0; i < (M); i++) {
    scanf("%lld%lld", &A[i], &B[i]);
    A[i]--;
    B[i]--;
    g[A[i]].push_back(B[i]);
    rg[B[i]].push_back(A[i]);
  }
  vector<vector<long long>> h;
  SCC::decompose(g, h, comp);
  set<pair<long long, long long>> latte;
  for (long long s = 0; s < (h.size()); s++) {
    vector<long long> ei(h.size());
    ei[s] = 1;
    for (long long v = s; v < h.size(); v++) {
      for (auto u : h[v]) {
        ei[u] += ei[v];
      }
    }
    for (auto u : h[s]) {
      if (ei[u] != 1) latte.insert({s, u});
    }
  }
  for (long long i = 0; i < (M); i++) {
    if (latte.find({comp[A[i]], comp[B[i]]}) != latte.end()) ans[i] = true;
  }
  latte = set<pair<long long, long long>>();
  for (long long i = 0; i < (N); i++) {
    memset(semi, -1, sizeof(semi));
    memset(re, 0, sizeof(re));
    memset(mark, 0, sizeof(mark));
    dfs(i, -5);
    for (long long j = 0; j < (N); j++)
      if (j == semi[j]) dfs2(j);
    for (long long j = 0; j < (M); j++)
      if (comp[A[j]] == comp[i] && comp[B[j]] == comp[i] &&
          semi[A[j]] != semi[B[j]] && (A[j] != i || semi[B[j]] != B[j]))
        mark[B[j]] = true;
    for (long long j = 0; j < (N); j++)
      if (mark[j] && re[j]) mark[semi[j]] = true;
    for (auto u : g[i])
      if (u == semi[u] && !mark[u]) latte.insert({i, u});
  }
  for (long long i = 0; i < (M); i++) {
    if (latte.find({A[i], B[i]}) != latte.end()) ans[i] = true;
  }
  for (long long i = 0; i < (M); i++) {
    if (ans[i])
      puts("diff");
    else
      puts("same");
  }
  return 0;
}
