#include <bits/stdc++.h>

using namespace std;

int main() {
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> from(m);
  vector<int> to(m);
  vector<vector<int>> g(n);
  for (int i = 0; i < m; ++i) {
    cin >> from[i] >> to[i];
    --from[i]; --to[i];
    g[from[i]].push_back(to[i]);
  }
  vector<vector<bool>> reach(n, vector<bool>(n));
  for (int f = 0; f < n; ++f) {
    function<void(int)> dfs = [&](int v) {
      reach[f][v] = true;
      for (int u : g[v]) {
        if (!reach[f][u]) {
          dfs(u);
        }
      }
    };
    dfs(f);
  }
  vector<vector<bool>> another(n, vector<bool>(n));
  for (int f = 0; f < n; ++f) {
    vector<int> foo(n, -1);
    function<void(int, int)> dfs_foo = [&](int v, int w) {
      foo[v] = w;
      for (int u : g[v]) {
        if (u != f && foo[u] == -1) {
          dfs_foo(u, w);
        }
      }
    };
    for (int i = 0; i < (int) g[f].size(); ++i) {
      int v = g[f][i];
      if (foo[v] == -1) {
        dfs_foo(v, i);
      }
    }
    vector<int> bar(n, -1);
    function<void(int, int)> dfs_bar = [&](int v, int w) {
      bar[v] = w;
      for (int u : g[v]) {
        if (u != f && bar[u] == -1) {
          dfs_bar(u, w);
        }
      }
    };
    for (int i = (int) g[f].size() - 1; ~i; --i) {
      int v = g[f][i];
      if (bar[v] == -1) {
        dfs_bar(v, i);
      }
    }
    for (int t = 0; t < n; ++t) {
      if (foo[t] != bar[t]) {
        another[f][t] = true;
      }
    }
  }
  for (int i = 0; i < m; ++i) {
    cout << (reach[to[i]][from[i]] == another[from[i]][to[i]] ? "same" : "diff") << "\n";
  }
  return 0;
}
