#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
vector<vector<int>> nodes;
vector<bool> visited;
void mark(int t, int c, int id, vector<int> &map) {
  if (c == t || visited[c]) return;
  visited[c] = true;
  map[c] = id;
  cerr << c << endl;
  for (auto i = 0; i < nodes[c].size(); i++) {
    mark(t, nodes[c][i], id, map);
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<Edge> e(m);
  nodes.resize(n + 1);
  for (auto i = 0; i < m; i++) {
    cin >> e[i].first >> e[i].second;
    nodes[e[i].first].push_back(e[i].second);
  }
  vector<vector<int>> fMap(n + 1, vector<int>(n, 0)),
      dMap(n + 1, vector<int>(n, 0));
  for (auto i = 1; i < n + 1; i++) {
    visited.assign(n, false);
    int id = 1;
    for (auto j = 0; j < nodes[i].size(); j++) {
      mark(i, nodes[i][j], id++, fMap[i]);
    }
    visited.assign(n, false);
    id = (int)nodes[i].size();
    for (auto j = nodes[i].size(); j > 0; --j) {
      mark(i, nodes[i][j - 1], id--, dMap[i]);
    }
  }
  for (auto i = 0; i < m; i++) {
    auto edge = e[i];
    if (fMap[edge.first][edge.second] != dMap[edge.first][edge.second] ==
        fMap[edge.second][edge.first] > 0) {
      cout << "same" << endl;
    } else {
      cout << "diff" << endl;
    }
  }
}
