#include <bits/stdc++.h>
using namespace std;
class korasaju {
 private:
  const int default_size = 100100;
  vector<vector<int>> normal;
  vector<vector<int>> reverso;
  vector<int> visited;
  vector<int> component;
  int number_of_components;
  int my_size;

 public:
  korasaju() {
    my_size = default_size;
    clear();
  }
  korasaju(int size) {
    my_size = size;
    clear();
  }
  void clear() {
    normal.assign(my_size, vector<int>());
    reverso.assign(my_size, vector<int>());
    visited.assign(my_size, 0);
    component.assign(my_size, 0);
    number_of_components = 0;
  }
  void addEdge(int u, int v) {
    normal[u].push_back(v);
    reverso[v].push_back(u);
  }
  void dfsNormal(vector<int>& passed_by, int cur) {
    visited[cur] = 1;
    for (int nxt : normal[cur])
      if (!visited[nxt]) dfsNormal(passed_by, nxt);
    passed_by.push_back(cur);
  }
  void dfsReverso(vector<int>& passed_by, int cur) {
    visited[cur] = 1;
    for (int nxt : reverso[cur])
      if (!visited[nxt]) dfsReverso(passed_by, nxt);
    passed_by.push_back(cur);
  }
  void build() {
    number_of_components = 0;
    vector<int> topological_sort;
    fill(visited.begin(), visited.end(), 0);
    for (int e = 0; e < my_size; e++)
      if (!visited[e]) dfsNormal(topological_sort, e);
    reverse(topological_sort.begin(), topological_sort.end());
    fill(visited.begin(), visited.end(), 0);
    for (int vertex : topological_sort) {
      if (!visited[vertex]) {
        vector<int> novo_component;
        dfsReverso(novo_component, vertex);
        for (int vertex_on_component : novo_component)
          component[vertex_on_component] = number_of_components;
        number_of_components++;
      }
    }
  }
  int getNumberOfComponents() { return number_of_components; }
  int getComponentOfVertex(int vertex) { return component[vertex]; }
  vector<int> getComponent() { return component; }
  vector<vector<int>> getDagComponent() {
    vector<vector<int>> dag;
    dag.resize(number_of_components);
    for (int u = 0; u < my_size; u++)
      for (int v : normal[u])
        if (getComponentOfVertex(u) != getComponentOfVertex(v))
          dag[getComponentOfVertex(u)].push_back(getComponentOfVertex(v));
    for (int e = 0; e < number_of_components; e++) {
      sort(dag[e].begin(), dag[e].end());
      dag[e].erase(unique(dag[e].begin(), dag[e].end()), dag[e].end());
    }
    return dag;
  }
};
const int maxn = 1111;
using bs = bitset<maxn>;
vector<int> en[maxn], er[maxn], dag[maxn];
int vis[maxn], visn[maxn], visr[maxn];
vector<pair<int, int>> taked;
bs reach[maxn];
void dfs(int i) {
  if (vis[i]) return;
  vis[i] = 1;
  reach[i].set(i);
  for (auto e : dag[i]) {
    dfs(e);
    reach[i] |= reach[e];
  }
}
void dfsn(int i) {
  visn[i] = 1;
  for (auto e : en[i]) {
    if (!visn[e]) {
      taked.push_back({i, e});
      dfsn(e);
    }
  }
}
void dfsr(int i) {
  visr[i] = 1;
  for (auto e : er[i]) {
    if (!visr[e]) {
      taked.push_back({i, e});
      dfsr(e);
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  korasaju ko(n);
  vector<pair<int, int>> eds;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    ko.addEdge(u, v);
    eds.push_back({u, v});
  }
  ko.build();
  int ncmp = ko.getNumberOfComponents();
  set<pair<int, int>> good_edges;
  for (int i = 0; i < m; i++) {
    int u, v;
    tie(u, v) = eds[i];
    int nu = ko.getComponentOfVertex(u);
    int nv = ko.getComponentOfVertex(v);
    if (nu != nv) {
      dag[nu].push_back(nv);
    } else {
      en[u].push_back(v);
      er[v].push_back(u);
    }
  }
  for (int i = 0; i < ncmp; i++) {
    sort(dag[i].begin(), dag[i].end());
    dag[i].erase(unique(dag[i].begin(), dag[i].end()), dag[i].end());
  }
  for (int i = 0; i < n; i++) {
    if (!visn[i]) {
      dfsn(i);
      for (auto e : taked) good_edges.insert(e);
      taked.clear();
    }
    if (!visr[i]) {
      dfsr(i);
      for (auto e : taked) {
        swap(e.first, e.second);
        good_edges.insert(e);
      }
      taked.clear();
    }
  }
  for (int i = 0; i < ncmp; i++) {
    dfs(i);
  }
  auto count_cmp = [&]() {
    korasaju meh(n);
    for (auto e : eds) {
      int u, v;
      tie(u, v) = e;
      meh.addEdge(u, v);
    }
    meh.build();
    return meh.getNumberOfComponents();
  };
  for (int i = 0; i < m; i++) {
    int u, v;
    tie(u, v) = eds[i];
    int nu = ko.getComponentOfVertex(u);
    int nv = ko.getComponentOfVertex(v);
    if (nu != nv) {
      bool can = false;
      for (auto to : dag[nu]) {
        if (to == nv) continue;
        if (reach[to][nv]) can = true;
      }
      if (can)
        printf("diff\n");
      else
        printf("same\n");
    } else {
      if (good_edges.count({u, v})) {
        eds[i] = {v, u};
        if (count_cmp() == ncmp)
          printf("same\n");
        else
          printf("diff\n");
        eds[i] = {u, v};
      } else {
        printf("same\n");
      }
    }
  }
  return 0;
}
