#include <bits/stdc++.h>
using namespace std;
int n, m;
int dfn[1010], low[1010], up[1010], dft, bel[1010], blt, st[1010], tp;
map<int, int> mp[1010];
int ans[202000];
void tar(int x) {
  dfn[x] = low[x] = ++dft;
  st[++tp] = x;
  for (auto &o : mp[x]) {
    int y = o.first;
    if (dfn[y]) {
      if (!bel[y]) low[x] = min(low[x], dfn[y]);
    } else {
      tar(y);
      low[x] = min(low[x], low[y]);
    }
  }
  if (dfn[x] == low[x]) {
    ++blt;
    for (;;) {
      bel[st[tp]] = blt;
      if (st[tp--] == x) break;
    }
  }
}
void dfs(int x, int *vis, int tp) {
  if (vis[x]) return;
  vis[x] = tp;
  for (auto &o : mp[x]) dfs(o.first, vis, tp);
}
int fl[1010];
void doit(int x) {
  memset(up, 0, sizeof up);
  memset(low, 0, sizeof low);
  up[x] = low[x] = x;
  memset(fl, 0, sizeof fl);
  for (auto &o : mp[x]) fl[o.first] = 1;
  for (int i = 1; i <= n; ++i)
    if (fl[i]) dfs(i, low, i);
  for (int i = n; i; --i)
    if (fl[i]) dfs(i, up, i);
  for (int i = 1; i <= n; ++i)
    if (fl[i]) {
      ans[mp[x][i]] = (bel[x] != bel[i]) ^ (up[i] == low[i]);
    }
}
int main() {
  cin >> n >> m;
  int x, y;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y), mp[x][y] = i;
  }
  for (int i = 1; i <= n; ++i)
    if (!dfn[i]) tar(i);
  for (int i = 1; i <= n; ++i) doit(i);
  for (int i = 1; i <= m; ++i) puts(ans[i] ? "diff" : "same");
}
