#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
inline long long getint() {
  long long _x = 0, _tmp = 1;
  char _tc = getchar();
  while ((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
  if (_tc == '-') _tc = getchar(), _tmp = -1;
  while (_tc >= '0' && _tc <= '9') _x *= 10, _x += (_tc - '0'), _tc = getchar();
  return _x * _tmp;
}
inline long long add(long long _x, long long _y,
                     long long _mod = 1000000007LL) {
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline long long sub(long long _x, long long _y,
                     long long _mod = 1000000007LL) {
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline long long mul(long long _x, long long _y,
                     long long _mod = 1000000007LL) {
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
long long mypow(long long _a, long long _x, long long _mod) {
  if (_x == 0) return 1LL;
  long long _ret = mypow(mul(_a, _a, _mod), _x >> 1, _mod);
  if (_x & 1) _ret = mul(_ret, _a, _mod);
  return _ret;
}
long long mymul(long long _a, long long _x, long long _mod) {
  if (_x == 0) return 0LL;
  long long _ret = mymul(add(_a, _a, _mod), _x >> 1, _mod);
  if (_x & 1) _ret = add(_ret, _a, _mod);
  return _ret;
}
inline bool equal(double _x, double _y) {
  return _x > _y - 1e-9 && _x < _y + 1e-9;
}
void sleep(double sec = 1021) {
  clock_t s = clock();
  while (clock() - s < CLOCKS_PER_SEC * sec)
    ;
}
int __ = 1, _cs;
struct Scc {
  int n, nScc, vst[1021], bln[1021];
  vector<int> E[1021], rE[1021], vec;
  void init(int _n) {
    n = _n;
    for (int i = 0; i < 1021; i++) {
      E[i].clear();
      rE[i].clear();
    }
  }
  void add_edge(int u, int v) {
    E[u].push_back(v);
    rE[v].push_back(u);
  }
  void DFS(int u) {
    vst[u] = 1;
    for (auto v : E[u])
      if (!vst[v]) DFS(v);
    vec.push_back(u);
  }
  void rDFS(int u) {
    vst[u] = 1;
    bln[u] = nScc;
    for (auto v : rE[u])
      if (!vst[v]) rDFS(v);
  }
  void solve() {
    nScc = 0;
    vec.clear();
    memset(vst, 0, sizeof(vst));
    for (int i = 0; i < n; i++)
      if (!vst[i]) DFS(i);
    reverse(vec.begin(), vec.end());
    memset(vst, 0, sizeof(vst));
    for (auto v : vec) {
      if (!vst[v]) {
        rDFS(v);
        nScc++;
      }
    }
  }
} graph;
void build() {}
int n, m, a[202020], b[202020];
void init() {
  n = getint();
  m = getint();
  graph.init(n);
  for (int i = 0; i < m; i++) {
    a[i] = getint() - 1;
    b[i] = getint() - 1;
    graph.add_edge(a[i], b[i]);
  }
  graph.solve();
}
vector<int> vv[1021];
int ind[1021], dst[1021][1021];
int way[1021][1021], instk[1021];
void go(int fr, int now) {
  instk[now] = 1;
  for (int nxt : graph.E[now]) {
    if (way[fr][nxt]) {
      if (instk[nxt]) continue;
      if (way[fr][nxt] == 2) continue;
      way[fr][nxt] = 2;
      go(fr, nxt);
      continue;
    }
    way[fr][nxt] = 1;
    go(fr, nxt);
  }
  instk[now] = 0;
}
void solve() {
  for (int i = 0; i < n; i++) {
    way[i][i] = 1;
    go(i, i);
  }
  {
    for (int i = 0; i < m; i++)
      if (graph.bln[a[i]] != graph.bln[b[i]]) {
        vv[graph.bln[a[i]]].push_back(graph.bln[b[i]]);
        ind[graph.bln[b[i]]]++;
      }
    vector<int> topo;
    for (int i = 0; i < graph.nScc; i++)
      if (ind[i] == 0) topo.push_back(i);
    for (size_t _ = 0; _ < topo.size(); _++) {
      int i = topo[_];
      for (auto nxt : vv[i]) {
        for (size_t _s = 0; _s <= _; _s++) {
          int fr = topo[_s];
          if (fr == i or dst[fr][i])
            dst[fr][nxt] = max(dst[fr][nxt], dst[fr][i] + 1);
        }
        ind[nxt]--;
        if (ind[nxt] == 0) topo.push_back(nxt);
      }
    }
  }
  for (int i = 0; i < m; i++)
    if (graph.bln[a[i]] != graph.bln[b[i]]) {
      if (dst[graph.bln[a[i]]][graph.bln[b[i]]] > 1)
        puts("diff");
      else
        puts("same");
    } else {
      if (way[a[i]][b[i]] > 1)
        puts("same");
      else
        puts("diff");
    }
}
int main() {
  build();
  while (__--) {
    init();
    solve();
  }
}
