#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) {
  a[fl][st][x] = fir;
  for (int i = head[x]; i; i = e[i].next)
    if (e[i].to != st && !a[fl][st][e[i].to]) dfs(fl, e[i].to, st, fir);
}
char B[1 << 26], *S = B;
int read() {
  int x = 0;
  char c = (*S++);
  while (c < '0' || c > '9') c = (*S++);
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = (*S++);
  }
  return x;
}
int main() {
  fread(B, 1, 1 << 26, stdin);
  n = read();
  m = read();
  for (int i = 1; i <= m; ++i) {
    x[i] = read();
    y[i] = read();
    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] && !a[0][i][j]) dfs(0, j, i, j);
  for (int i = 1; i <= n; ++i)
    for (int j = n; j; --j)
      if (p[i][j] && !a[1][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;
}
