#include <bits/stdc++.h>
int head[1024], last[262144], to[262144], cnt = 0;
void add(int u, int v) {
  cnt++;
  last[cnt] = head[u];
  head[u] = cnt;
  to[cnt] = v;
}
int tp[1024];
void dfs(int u, int t) {
  if (tp[u] == t || tp[u] < 0) {
    return;
  }
  if (!tp[u]) {
    tp[u] = t;
  } else {
    tp[u] = -1;
  }
  for (int i = head[u]; i; i = last[i]) {
    dfs(to[i], t);
  }
}
int vis[1005][1005];
int a[262144], b[262144];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a[i], &b[i]);
    add(a[i], b[i]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      tp[j] = 0;
    }
    tp[i] = -1;
    for (int j = head[i]; j; j = last[j]) {
      dfs(to[j], to[j]);
    }
    for (int j = 1; j <= n; j++) {
      if (!tp[j]) {
        vis[i][j] = 0;
      } else if (tp[j] == j) {
        vis[i][j] = 1;
      } else {
        vis[i][j] = 2;
      }
    }
  }
  for (int i = 0; i < m; i++) {
    if ((vis[a[i]][b[i]] >= 2) ^ (vis[b[i]][a[i]] >= 1)) {
      printf("diff\n");
    } else {
      printf("same\n");
    }
  }
  return 0;
}
