#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int M = 200005;
struct edge {
  int to, next;
} e[M];
int head[N], tot;
int n, m, x[N], y[N];
int co1[N][N], co2[N][N];
int vis[N], q[N];
void add(int x, int y) {
  e[++tot] = (edge){y, head[x]};
  head[x] = tot;
}
void dfs(int x, int co) {
  vis[x] = co;
  for (int i = head[x]; i; i = e[i].next)
    if (!vis[e[i].to]) dfs(e[i].to, co);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (int)(1); i <= (int)(m); i++) {
    scanf("%d%d", &x[i], &y[i]);
    add(x[i], y[i]);
  }
  for (int i = (int)(1); i <= (int)(n); i++) {
    *q = 0;
    for (int j = head[i]; j; j = e[j].next) q[++*q] = e[j].to;
    for (int j = (int)(1); j <= (int)(n); j++) vis[j] = (j == i ? -1 : 0);
    for (int j = (int)(1); j <= (int)(*q); j++)
      if (!vis[q[j]]) dfs(q[j], q[j]);
    for (int j = (int)(1); j <= (int)(n); j++) co1[i][j] = vis[j];
    for (int j = (int)(1); j <= (int)(n); j++) vis[j] = (j == i ? -1 : 0);
    for (int j = (int)(*q); j >= (int)(1); j--)
      if (!vis[q[j]]) dfs(q[j], q[j]);
    for (int j = (int)(1); j <= (int)(n); j++) co2[i][j] = vis[j];
  }
  for (int i = (int)(1); i <= (int)(m); i++) {
    bool f1 = (co1[y[i]][x[i]] != 0);
    bool f2 = (co2[x[i]][y[i]] && co2[x[i]][y[i]] != y[i]) ||
              (co1[x[i]][y[i]] && co1[x[i]][y[i]] != y[i]);
    puts(f1 ^ f2 ? "diff" : "same");
  }
}
