#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1007;
const int MAXM = 2e6 + 7;
int head[MAXN], b[MAXN], num, n, m, l, x[MAXM], y[MAXM], s, t;
struct po {
  int nxt, to;
} edge[MAXM];
inline int read() {
  int x = 0, c = 1;
  char ch = ' ';
  while ((ch > '9' || ch < '0') && ch != '-') ch = getchar();
  while (ch == '-') c *= -1, ch = getchar();
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - '0', ch = getchar();
  return x * c;
}
inline void add_edge(int from, int to) {
  edge[++num].nxt = head[from];
  edge[num].to = to;
  head[from] = num;
}
inline int bfs1() {
  memset(b, 0, sizeof(b));
  b[s] = 1;
  queue<int> q;
  while (!q.empty()) q.pop();
  q.push(s);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = head[u]; i; i = edge[i].nxt) {
      int v = edge[i].to;
      if (u == s && v == t) continue;
      if (!b[v]) {
        b[v] = 1;
        if (v == t) return 1;
        q.push(v);
      }
    }
  }
  return 0;
}
inline int bfs2() {
  memset(b, 0, sizeof(b));
  b[t] = 1;
  queue<int> q;
  while (!q.empty()) q.pop();
  q.push(t);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = head[u]; i; i = edge[i].nxt) {
      int v = edge[i].to;
      if (!b[v]) {
        b[v] = 1;
        if (v == s) return 1;
        q.push(v);
      }
    }
  }
  return 0;
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= m; i++) {
    x[i] = read();
    y[i] = read();
    add_edge(x[i], y[i]);
  }
  for (int i = 1; i <= m; i++) {
    s = x[i], t = y[i];
    int c1 = bfs1();
    int c2 = bfs2();
    if (c1 == c2)
      puts("same");
    else
      puts("diff");
  }
}
