#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<vector<int> > from;
vector<vector<int> > to;
vector<pair<int, int> > e;
vector<int> scd_tmp;
vector<bool> visited_tmp;
vector<int> scd_group;
int scd_group_num;
void dfs(int i, vector<vector<int> > to_) {
  if (scd_group[i] >= 0) return;
  if (visited_tmp[i]) return;
  visited_tmp[i] = true;
  for (int j : to_[i]) {
    if (find(scd_tmp.begin(), scd_tmp.end(), j) == scd_tmp.end()) {
      dfs(j, to);
    }
  }
  scd_tmp.push_back(i);
  return;
}
void scd() {
  scd_group = vector<int>(n, -1);
  scd_group_num = 0;
  for (int i = 0; i < n; i++) {
    if (scd_group[i] >= 0) continue;
    scd_tmp.clear();
    visited_tmp = vector<bool>(n, 0);
    dfs(i, to);
    reverse(scd_tmp.begin(), scd_tmp.end());
    while (!scd_tmp.empty()) {
      vector<int> search{scd_tmp[0]};
      while (!search.empty()) {
        scd_tmp.erase(find(scd_tmp.begin(), scd_tmp.end(), search.front()));
        scd_group[search.front()] = scd_group_num;
        for (auto j : from[search.front()]) {
          if (find(scd_tmp.begin(), scd_tmp.end(), j) != scd_tmp.end() &&
              find(search.begin(), search.end(), j) == search.end()) {
            search.push_back(j);
          }
        }
        search.erase(search.begin());
      }
      scd_group_num++;
    }
  }
}
int startTmp;
bool dfs_(int i, int j) {
  if (i == j) return true;
  visited_tmp[i] = true;
  for (auto k : to[i]) {
    if (i == startTmp && k == j) continue;
    if (!visited_tmp[k]) {
      bool tmp = dfs_(k, j);
      if (tmp) return true;
    }
  }
  return false;
}
bool isReachable(int start, int dest) {
  startTmp = start;
  visited_tmp = vector<bool>(n, false);
  return dfs_(start, dest);
}
int main() {
  cin >> n >> m;
  from.resize(n);
  to.resize(n);
  e.resize(m);
  for (int i = 0; i < m; i++) {
    int tmp1, tmp2;
    cin >> tmp1 >> tmp2;
    tmp1--;
    tmp2--;
    to[tmp1].push_back(tmp2);
    from[tmp2].push_back(tmp1);
    e[i] = make_pair(tmp1, tmp2);
  }
  scd();
  vector<vector<int> > groupReachable;
  for (int i = 0; i < m; i++) {
    if (scd_group[e[i].first] == scd_group[e[i].second]) {
      if (isReachable(e[i].first, e[i].second)) {
        cout << "same\n";
      } else {
        cout << "diff\n";
      }
    } else {
      if (!isReachable(e[i].first, e[i].second)) {
        cout << "same\n";
      } else {
        cout << "diff\n";
      }
    }
  }
  return 0;
}
