#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T &res) {
  res = 0;
  char c = getchar();
  T f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    res = res * 10 + c - '0';
    c = getchar();
  }
  res *= f;
}
template <class T>
void out(T x) {
  if (x < 0) {
    x = -x;
    putchar('-');
  }
  if (x >= 10) {
    out(x / 10);
  }
  putchar('0' + x % 10);
}
struct node {
  int to, next, id;
} E[200005];
int head[1005], sumE, M, N, a[200005], b[200005];
bool reachable[1005][1005], mark[1005], a1[200005], a2[200005];
vector<int> v;
void add(int u, int v, int id) {
  E[++sumE].to = v;
  E[sumE].next = head[u];
  E[sumE].id = id;
  head[u] = sumE;
}
void dfs(int id, int u) {
  reachable[id][u] = 1;
  for (int i = head[u]; i; i = E[i].next) {
    int v = E[i].to;
    if (!reachable[id][v]) {
      dfs(id, v);
    }
  }
}
void dfs2(int u) {
  if (mark[u]) return;
  mark[u] = 1;
  for (int i = head[u]; i; i = E[i].next) {
    int v = E[i].to;
    if (!mark[v]) dfs2(v);
  }
}
void Solve() {
  read(N);
  read(M);
  for (int i = 1; i <= M; ++i) {
    read(a[i]);
    read(b[i]);
    add(a[i], b[i], i);
  }
  for (int i = 1; i <= N; ++i) {
    dfs(i, i);
  }
  for (int u = 1; u <= N; ++u) {
    v.clear();
    for (int i = head[u]; i; i = E[i].next) {
      v.push_back(E[i].id);
    }
    memset(mark, 0, sizeof(mark));
    mark[u] = 1;
    int s = v.size();
    for (int i = 0; i < s; ++i) {
      a2[v[i]] |= mark[b[v[i]]];
      dfs2(b[v[i]]);
    }
    memset(mark, 0, sizeof(mark));
    mark[u] = 1;
    for (int i = s - 1; i >= 0; --i) {
      a2[v[i]] |= mark[b[v[i]]];
      dfs2(b[v[i]]);
    }
  }
  for (int i = 1; i <= M; ++i) {
    if (reachable[b[i]][a[i]]) a1[i] = 1;
    if (a1[i] ^ a2[i])
      puts("diff");
    else
      puts("same");
  }
}
int main() {
  Solve();
  return 0;
}
