#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
const int M = 4e5 + 5;
int n, m, x, y;
int fi[N], nt[M], to[M], tot;
void link(int x, int y) { nt[++tot] = fi[x], to[tot] = y, fi[x] = tot; }
int bz[N];
void dg(int x) {
  if (bz[x]) return;
  bz[x] = 1;
  for (int i = fi[x]; i; i = nt[i]) dg(to[i]);
}
int b[N][N];
int d[N], d0, ky[N][N];
void dfs(int x) {
  if (bz[x]) return;
  bz[x] = 1;
  for (int i = fi[x]; i; i = nt[i]) dfs(to[i]);
}
int ans[M];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1, B = m; i <= B; i++) {
    scanf("%d %d", &x, &y);
    link(x, y);
  }
  for (int st = 1, B = n; st <= B; st++) {
    memset(bz, 0, sizeof bz);
    d0 = 0;
    for (int i = fi[st]; i; i = nt[i]) d[++d0] = to[i];
    bz[st] = 1;
    for (int i = 1, B = d0; i <= B; i++) {
      ky[st][d[i]] |= bz[d[i]];
      dfs(d[i]);
    }
    for (int j = 1, B = n; j <= B; j++) b[st][j] |= bz[j];
    memset(bz, 0, sizeof bz);
    bz[st] = 1;
    for (int i = d0, B = 1; i >= B; i--) {
      ky[st][d[i]] |= bz[d[i]];
      dfs(d[i]);
    }
    for (int j = 1, B = n; j <= B; j++) b[st][j] |= bz[j];
  }
  for (int st = 1, B = n; st <= B; st++) {
    for (int i = fi[st]; i; i = nt[i]) ans[i] = b[to[i]][st] ^ ky[st][to[i]];
  }
  for (int i = 1, B = m; i <= B; i++) printf("%s\n", ans[i] ? "diff" : "same");
}
