#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<pair<int, int> > g[200000];
using int64 = unsigned long long;
bool ans[200000];
struct StronglyConnectedComponents {
  vector<vector<int> > gg, rg;
  vector<pair<int, int> > edges;
  vector<int> comp, order, used;
  StronglyConnectedComponents(size_t v)
      : gg(v), rg(v), comp(v, -1), used(v, 0) {}
  void add_edge(int x, int y) {
    gg[x].push_back(y);
    rg[y].push_back(x);
    edges.emplace_back(x, y);
  }
  int operator[](int k) { return (comp[k]); }
  void dfs(int idx) {
    if (used[idx]) return;
    used[idx] = true;
    for (int to : gg[idx]) dfs(to);
    order.push_back(idx);
  }
  void rdfs(int idx, int cnt) {
    if (comp[idx] != -1) return;
    comp[idx] = cnt;
    for (int to : rg[idx]) rdfs(to, cnt);
  }
  void build() {
    for (int i = 0; i < gg.size(); i++) dfs(i);
    reverse(begin(order), end(order));
    int ptr = 0;
    for (int i : order)
      if (comp[i] == -1) rdfs(i, ptr), ptr++;
  }
};
void dfs(int idx) {
  vector<int> order, used(N);
  function<void(int)> dfs2 = [&](int a) {
    if (used[a]++) return;
    for (auto &e : g[a]) dfs2(e.first);
    order.emplace_back(a);
  };
  dfs2(idx);
  reverse(begin(order), end(order));
  for (int _ = 0; _ < g[idx].size(); _ += 64) {
    int l = _, r = min<int>(g[idx].size(), _ + 64);
    vector<int64> dp(N);
    vector<vector<int64> > qs(N);
    for (int i = l; i < r; i++) {
      auto &e = g[idx][i];
      qs[e.first].emplace_back(i - l);
      dp[idx] |= 1uLL << (i - l);
    }
    for (auto &p : order) {
      for (int i = 0; i < g[p].size(); i++) {
        auto &e = g[p][i];
        if (p == idx && l <= i && i < r && (dp[p] >> (i - l)) & 1) {
          dp[e.first] |= dp[p] ^ (1uLL << (i - l));
        } else
          dp[e.first] |= dp[p];
      }
    }
    for (int i = 0; i < N; i++) {
      for (auto &s : qs[i]) {
        if ((dp[i] >> s) & 1) ans[g[idx][s + l].second] = true;
      }
    }
  }
}
int X[200000], Y[200000];
int main() {
  scanf("%d %d", &N, &M);
  StronglyConnectedComponents scc(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a, --b;
    X[i] = a, Y[i] = b;
    g[a].emplace_back(b, i);
    scc.add_edge(a, b);
  }
  scc.build();
  for (int i = 0; i < N; i++) {
    dfs(i);
  }
  for (int i = 0; i < M; i++) {
    puts(ans[i] ^ (scc[X[i]] == scc[Y[i]]) ? "diff" : "same");
  }
}
