#include <bits/stdc++.h>
using namespace std;
vector<int> to[1010];
int n, m, a[200010], b[200010], fi[2][1010][1010];
int V[1010], v[1010], X, now, dfn[1010], low[1010], bl[1010], sta[1010], top,
    num, dcc;
void tj(const register int x) {
  sta[++top] = x;
  v[x] = 1;
  dfn[x] = low[x] = ++num;
  for (int y : to[x])
    if (!dfn[y])
      tj(y), low[x] = min(low[x], low[y]);
    else if (v[y])
      low[x] = min(low[x], dfn[y]);
  if (low[x] == dfn[x]) {
    ++dcc;
    while (sta[top] != x) bl[sta[top]] = dcc, v[sta[top--]] = 0;
    bl[sta[top]] = dcc;
    v[sta[top--]] = 0;
  }
}
void dfs(const register int x, const register int opt, const register int fr) {
  if (V[x] == now) return;
  fi[opt][X][x] = fr;
  for (int y : to[x]) dfs(y, opt, fr);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++)
    scanf("%d%d", &a[i], &b[i]), to[a[i]].push_back(b[i]);
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) tj(i);
  for (int i = 1; i <= n; i++) {
    V[i] = ++now;
    X = i;
    for (int j = 0; j < to[i].size(); j++) dfs(to[i][j], 0, to[i][j]);
    V[i] = ++now;
    for (int j = -1 + to[i].size(); ~j; j--) dfs(to[i][j], 1, to[i][j]);
  }
  for (int i = 1; i <= m; i++) {
    const register int x = a[i], y = b[i];
    if (bl[x] != bl[y] && fi[0][x][y] != fi[1][x][y])
      puts("diff");
    else if (bl[x] == bl[y] && fi[0][x][y] == y && fi[1][x][y] == y)
      puts("diff");
    else
      puts("same");
  }
}
