#include <bits/stdc++.h>
using std::abs;
using std::array;
using std::cerr;
using std::cin;
using std::cout;
using std::generate;
using std::make_pair;
using std::map;
using std::max;
using std::max_element;
using std::min;
using std::min_element;
using std::pair;
using std::reverse;
using std::set;
using std::sort;
using std::string;
using std::unique;
using std::vector;
template <typename T>
T input() {
  T res;
  cin >> res;
  {};
  return res;
}
template <typename IT>
void input_seq(IT b, IT e) {
  std::generate(b, e,
                input<typename std::remove_reference<decltype(*b)>::type>);
}
struct edge {
  int to;
  int id;
};
void dfs(vector<vector<edge>>& graph, vector<int>& order, vector<char>& used,
         int v) {
  used[v] = 1;
  for (auto u : graph[v])
    if (not used[u.to]) dfs(graph, order, used, u.to);
  order.push_back(v);
}
void dfs2(vector<vector<edge>>& rgraph, vector<int>& cid, int v, int c) {
  cid[v] = c;
  for (auto u : rgraph[v])
    if (cid[u.to] == -1) dfs2(rgraph, cid, u.to, c);
}
void dfs3(vector<vector<int>>& gr, vector<char>& used, int v) {
  used[v] = 1;
  for (auto u : gr[v])
    if (not used[u]) dfs3(gr, used, u);
}
void dfs4(vector<vector<edge>>& gr, vector<char>& used, int v, int bad) {
  used[v] = 1;
  for (auto u : gr[v])
    if (not used[u.to] and u.id != bad) dfs4(gr, used, u.to, bad);
}
void zhfs(vector<vector<edge>>& graph, vector<int>& cid, int v,
          vector<char>& used, vector<char>& mark) {
  used[v] = 1;
  for (auto u : graph[v])
    if (not used[u.to] and cid[u.to] == cid[v]) {
      mark[u.id] = 1;
      zhfs(graph, cid, u.to, used, mark);
    }
}
int main() {
  std::iostream::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n = input<int>();
  int m = input<int>();
  vector<char> ans(m, 0);
  vector<pair<int, int>> lst(m);
  vector<vector<edge>> graph(n);
  vector<vector<edge>> rgraph(n);
  vector<vector<int>> graph2(n);
  for (int i = 0; i != m; ++i) {
    int v, u;
    cin >> v >> u;
    --v, --u;
    graph[v].emplace_back(edge{u, i});
    rgraph[u].emplace_back(edge{v, i});
    lst[i] = make_pair(v, u);
  }
  vector<int> order;
  vector<char> used(n, false);
  for (int i = 0; i != n; ++i)
    if (not used[i]) dfs(graph, order, used, i);
  std::reverse(order.begin(), order.end());
  vector<int> cid(n, -1);
  int cur_id = 0;
  for (int v : order)
    if (cid[v] == -1) dfs2(rgraph, cid, v, cur_id++);
  vector<vector<int>> cgr(cur_id);
  for (int v = 0; v != n; ++v)
    for (auto u : graph[v])
      if (cid[v] != cid[u.to]) cgr[cid[v]].push_back(cid[u.to]);
  vector<vector<int>> matrix(cur_id, vector<int>(cur_id));
  for (int start = 0; start != cur_id; ++start) {
    matrix[start][start] = 1;
    for (int v = start; v != cur_id; ++v) {
      for (auto go : cgr[v]) {
        assert(go >= v);
        matrix[start][go] += matrix[start][v];
      }
    }
  }
  for (int v = 0; v != n; ++v)
    for (auto u : graph[v])
      if (cid[v] != cid[u.to]) ans[u.id] = matrix[cid[v]][cid[u.to]] >= 2;
  vector<vector<int>> by_cid(cur_id);
  for (int v = 0; v != n; ++v) by_cid[cid[v]].push_back(v);
  vector<char> mark(m, false);
  vector<char> used1(n, false), used2(n, false);
  for (int c = 0; c != cur_id; ++c) {
    zhfs(graph, cid, by_cid[c][0], used1, mark);
    zhfs(rgraph, cid, by_cid[c][0], used2, mark);
  }
  for (int i = 0; i != m; ++i)
    if (mark[i]) {
      std::fill(used.begin(), used.end(), false);
      dfs4(graph, used, lst[i].first, i);
      ans[i] = not used[lst[i].second];
    }
  for (auto elem : ans) cout << (elem ? "diff\n" : "same\n");
  return 0;
}
