#include <bits/stdc++.h>
template <class T1, class T2>
inline bool cmin(T1 &a, const T2 &b) {
  return b < a ? (a = b, true) : false;
}
template <class T1, class T2>
inline bool cmax(T1 &a, const T2 &b) {
  return a < b ? (a = b, true) : false;
}
template <class Type>
Type read() {
  Type a;
  bool b;
  unsigned char c;
  while (c = getchar() - 48, (c > 9) & (c != 253))
    ;
  for (a = (b = c == 253) ? 0 : c; (c = getchar() - 48) <= 9; a = a * 10 + c)
    ;
  return b ? -a : a;
}
auto rd = read<int>;
const int N = 1001, M = 2e5;
int n, m, a[M], b[M], head[N], next[M], rhead[N], rnext[N];
int queue[N], *qhead, *qtail, min[N], max[N];
bool vis[N], rev[M], without[M];
void bfs(int u) {
  qhead = qtail = queue;
  if (vis[u]) return;
  vis[ *qtail++ = u] = true;
  while (qhead != qtail) {
    u = *qhead++;
    for (int j = head[u]; j != -1; j = next[j])
      if (!vis[b[j]]) vis[ *qtail++ = b[j]] = true;
  }
}
int main() {
  n = rd(), m = rd();
  memset(head, -1, n * sizeof(int));
  memset(rhead, -1, n * sizeof(int));
  for (int i = 0; i < m; ++i) {
    a[i] = rd() - 1, b[i] = rd() - 1;
    next[i] = head[a[i]];
    head[a[i]] = i;
    rnext[i] = rhead[b[i]];
    rhead[b[i]] = i;
  }
  for (int i = 0; i < n; ++i) {
    memset(vis, 0, n);
    bfs(i);
    for (int j = rhead[i]; j != -1; j = rnext[j]) rev[j] = vis[a[j]];
  }
  for (int i = 0; i < n; ++i) {
    std::vector<int> out;
    for (int j = head[i]; j != -1; j = next[j]) out.push_back(j);
    memset(vis, 0, n);
    vis[i] = true;
    for (int j : out) {
      bfs(b[j]);
      for (int *p = queue; p != qtail; ++p) max[*p] = j;
    }
    std::reverse(out.begin(), out.end());
    memset(vis, 0, n);
    vis[i] = true;
    for (int j : out) {
      bfs(b[j]);
      for (int *p = queue; p != qtail; ++p) min[*p] = j;
    }
    for (int j = head[i]; j != -1; j = next[j])
      without[j] = (min[b[j]] != j) || (max[b[j]] != j);
  }
  for (int i = 0; i < m; ++i) puts(rev[i] ^ without[i] ? "diff" : "same");
  return 0;
}
