#include <bits/stdc++.h>
const int N = 1010, M = 200100;
bool g[N][N], ans[N][N];
int f0[N], f1[N];
int begin[N], next[M], to[M];
int e;
void add(int x, int y) {
  to[++e] = y;
  next[e] = begin[x];
  begin[x] = e;
}
void dfs(int p, int h) {
  if (g[h][p]) return;
  g[h][p] = 1;
  for (int i = begin[p]; i; i = next[i]) dfs(to[i], h);
}
void Dfs(int p, int h, int *f) {
  if (f[p]) return;
  f[p] = h;
  for (int i = begin[p]; i; i = next[i]) Dfs(to[i], h, f);
}
int n, m;
void work(int p) {
  static int seq[N], tot;
  tot = 0;
  for (int i = begin[p]; i; i = next[i]) seq[++tot] = to[i];
  std::sort(seq + 1, seq + tot + 1);
  memset(f0, 0, sizeof(f0)), memset(f1, 0, sizeof(f1));
  f0[p] = f1[p] = 2333;
  for (int i = 1; i <= tot; i++) Dfs(seq[i], seq[i], f0);
  for (int i = tot; i; i--) Dfs(seq[i], seq[i], f1);
  for (int i = 1; i <= n; i++) ans[p][i] = f0[i] != f1[i];
}
int E[M][2];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, u, v; i <= m; i++)
    scanf("%d%d", &u, &v), E[i][0] = u, E[i][1] = v, add(u, v);
  for (int i = 1; i <= n; i++) dfs(i, i);
  for (int i = 1; i <= n; i++) work(i);
  for (int i = 1; i <= m; i++) {
    int u = E[i][0], v = E[i][1];
    if (g[v][u])
      printf("%s\n", ans[u][v] ? "same" : "diff");
    else
      printf("%s\n", ans[u][v] ? "diff" : "same");
  }
  return 0;
}
