#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const int M = 200010;
struct edge {
  int to, next;
} e[M];
int n, m, cnt, x[M], y[M], head[N], a[2][N][N];
bitset<N> p[N];
void ins(int x, int y) {
  e[++cnt].to = y;
  e[cnt].next = head[x];
  head[x] = cnt;
}
void dfs(int fl, int x, int st, int fir) {
  if (a[fl][st][x]) return;
  a[fl][st][x] = fir;
  for (int i = head[x]; i; i = e[i].next)
    if (e[i].to != st) dfs(fl, e[i].to, st, fir);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x[i], &y[i]);
    p[x[i]][y[i]] = 1;
    ins(x[i], y[i]);
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (p[i][j]) dfs(0, j, i, j);
  for (int i = 1; i <= n; ++i)
    for (int j = n; j; --j)
      if (p[i][j]) dfs(1, j, i, j);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (p[j][i]) p[j] |= p[i];
  for (int i = 1; i <= m; ++i)
    if (p[y[i]][x[i]] ^ (a[0][x[i]][y[i]] != y[i] || a[1][x[i]][y[i]] != y[i]))
      puts("diff");
    else
      puts("same");
  return 0;
}
