#include <bits/stdc++.h>
const int MAXN = 1010;
std::vector<int> out[MAXN], rout[MAXN], ine[MAXN];
int n, m;
int* ind;
std::vector<int>* so;
void dfs(int t) {
  for (auto i : so[t])
    if (!ind[i]) ind[i] = t, dfs(i);
}
std::map<std::pair<int, int>, int> u2v, v2u;
int xs[MAXN], ys[MAXN];
int main() {
  std::ios_base::sync_with_stdio(false), std::cin.tie(0);
  std::cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    std::cin >> xs[i] >> ys[i];
    out[xs[i]].push_back(ys[i]);
    ine[ys[i]].push_back(xs[i]);
  }
  for (int i = 1; i <= n; ++i) {
    std::sort(out[i].begin(), out[i].end());
    rout[i].assign(out[i].rbegin(), out[i].rend());
  }
  static int i1[MAXN], i2[MAXN];
  for (int i = 1; i <= n; ++i) {
    memset(i1, 0, n + 1 << 2);
    memset(i2, 0, n + 1 << 2);
    so = out, ind = i1, i1[i] = n + 1;
    dfs(i);
    so = rout, ind = i2, i2[i] = n + 1;
    dfs(i);
    for (auto t : ine[i])
      if (i1[t]) v2u[std::pair<int, int>(t, i)] = true;
    for (auto t : out[i])
      if (i1[t] != i2[t] || i1[t] != i) u2v[std::pair<int, int>(i, t)] = true;
  }
  for (int i = 1; i <= m; ++i) {
    auto t = std::pair<int, int>(xs[i], ys[i]);
    std::cout << (u2v[t] ^ v2u[t] ? "diff\n" : "same\n");
  }
  return 0;
}
