#include<bits/stdc++.h>
using namespace std;

using Graph = vector<vector<int>>;

vector<vector<vector<int>>> reachable(auto G) {
  vector<vector<vector<int>>> ok(2, vector<vector<int>>(G.size(), vector<int>(G.size(), -1)));

  auto bfs = [&](auto root) {
    queue<int> q;
    vector<bool> used(G.size());
    used[root] = true;
    for(auto i=0; i<G[root].size(); ++i) {
      auto v = G[root][i];
      ok[0][root][v] = ok[1][root][v] = i;
      q.emplace(v);
      used[v] = true;
    }
    while(!q.empty()) {
      auto u = q.front();
      q.pop();
      for(auto v: G[u]) {
        if(ok[0][root][v] == -1) ok[0][root][v] = ok[0][root][u];
        ok[0][root][v] = min(ok[0][root][v], ok[0][root][u]);
        ok[1][root][v] = max(ok[1][root][v], ok[1][root][u]);
        if(used[v]) continue;
        q.emplace(v);
        used[v] = true;
      }
    }
  };

  for(auto root=0; root<G.size(); ++root) bfs(root);
  return ok;
}

int main() {
  int N, M;
  cin >> N >> M;
  Graph G(N);
  vector<int> a(M), b(M);
  for(auto i=0; i<M; ++i) {
    cin >> a[i] >> b[i];
    --a[i]; --b[i];
    G[a[i]].push_back(b[i]);
  }

  auto ok = reachable(G);

  for(auto i=0; i<M; ++i) {
    auto u = a[i], v = b[i];
    auto ab = ok[0][u][v]!=ok[1][u][v];
    auto ba = ok[0][v][u]!=-1;
    if(ab==ba) cout << "same" << endl;
    else       cout << "diff" << endl;
  }
}
