#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
template <class T>
inline bool MX(T &l, const T &r) {
  return l < r ? l = r, 1 : 0;
}
template <class T>
inline bool MN(T &l, const T &r) {
  return l > r ? l = r, 1 : 0;
}
struct DominatorTree {
  int n;
  vector<vector<int>> G, rG;
  vector<int> semi, id, et, par, mn, uf;
  DominatorTree(int n)
      : n(n), G(n), rG(n), semi(n), id(n, -1), et(n), par(n, -1), mn(n), uf(n) {
    for (int i = 0; i < n; i++) {
      semi[i] = mn[i] = uf[i] = i;
    }
  }
  void addEdge(int a, int b) {
    G[a].push_back(b);
    rG[b].push_back(a);
  }
  int find(int v) {
    if (uf[v] == v) return v;
    int a = find(uf[v]);
    if (id[semi[mn[uf[v]]]] < id[semi[mn[v]]]) mn[v] = mn[uf[v]];
    return uf[v] = a;
  }
  void link(int c, int p) { uf[c] = p; }
  void dfs(int v, int p, int &k) {
    id[v] = k;
    et[k++] = v;
    par[v] = p;
    for (int c : G[v])
      if (id[c] == -1) dfs(c, v, k);
  }
  vector<int> calc(int root) {
    int sz = 0;
    dfs(root, -1, sz);
    vector<int> us(n);
    vector<vector<int>> bucket(n);
    for (int i = sz - 1; i > 0; i--) {
      int w = et[i];
      for (int v : rG[w])
        if (id[v] != -1) {
          find(v);
          if (id[semi[mn[v]]] < id[semi[w]]) semi[w] = semi[mn[v]];
        }
      bucket[semi[w]].emplace_back(w);
      for (int v : bucket[par[w]]) {
        find(v);
        us[v] = mn[v];
      }
      bucket[par[w]].clear();
      link(w, par[w]);
    }
    vector<int> idom(n, -1);
    for (int i = 1; i < sz; i++) {
      int w = et[i];
      if (semi[w] == semi[us[w]])
        idom[w] = semi[w];
      else
        idom[w] = idom[us[w]];
    }
    return idom;
  }
};
int N, M;
int A[214514];
int B[214514];
int rev[1145];
bool ans[214514];
vector<pair<int, int>> eds[1145];
struct Scc {
  stack<int> S;
  vector<int> inS, low, num;
  int time = 0;

 public:
  vector<vector<int>> rdag;
  vector<int> inv;
  vector<vector<int>> scc;
  void visit(const vector<vector<int>> &g, int v) {
    low[v] = num[v] = ++time;
    S.push(v);
    inS[v] = 1;
    for (const int &w : g[v]) {
      if (!num[w]) {
        visit(g, w);
        low[v] = min(low[v], low[w]);
      } else if (inS[w])
        low[v] = min(low[v], num[w]);
    }
    if (low[v] == num[v]) {
      scc.emplace_back();
      while (1) {
        int w = S.top();
        S.pop();
        inS[w] = 0;
        scc.back().emplace_back(w);
        if (v == w) break;
      }
    }
  }
  Scc(const vector<vector<int>> &g) {
    const int n = g.size();
    num.resize(n);
    low.resize(n);
    inS.resize(n);
    for (int(u) = 0; (u) < (n); ++(u))
      if (!num[u]) visit(g, u);
    reverse((scc).begin(), (scc).end());
    inv.resize(n);
    rdag.resize(scc.size());
    for (int(i) = 0; (i) < (scc.size()); ++(i))
      for (auto v : scc[i]) inv[v] = i;
    for (int(i) = 0; (i) < (scc.size()); ++(i))
      for (auto v : scc[i])
        for (auto e : g[v])
          if (inv[e] != i) {
            rdag[inv[e]].emplace_back(i);
          }
  }
};
signed main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(0);
  cin >> N >> M;
  vector<vector<int>> es(N);
  for (int(i) = 0; (i) < (M); ++(i)) {
    cin >> A[i] >> B[i];
    --A[i];
    --B[i];
    es[A[i]].emplace_back(B[i]);
    eds[A[i]].emplace_back(pair<int, int>(B[i], i));
  }
  Scc scc(es);
  for (int(v) = 0; (v) < (N); ++(v)) {
    DominatorTree dom(N + eds[v].size());
    int idx = N;
    for (int(i) = 0; (i) < (M); ++(i)) {
      if (A[i] == v) {
        dom.addEdge(A[i], idx);
        dom.addEdge(idx, B[i]);
        rev[B[i]] = idx;
        ++idx;
      } else {
        dom.addEdge(A[i], B[i]);
      }
    }
    auto idom = dom.calc(v);
    for (auto &e : eds[v]) {
      int u = e.first;
      int w = rev[u];
      ans[e.second] = (idom[u] != w) ^ (scc.inv[u] == scc.inv[v]);
    }
  }
  for (int(i) = 0; (i) < (M); ++(i)) {
    if (ans[i])
      cout << "diff\n";
    else
      cout << "same\n";
  }
}
