#include <bits/stdc++.h>
#pragma optimize("Ofast")
using namespace std;
const int N = 1005, M = 200005;
template <class T>
void read(T &x) {
  int sgn = 1;
  char ch;
  x = 0;
  for (ch = getchar(); (ch < '0' || ch > '9') && ch != '-'; ch = getchar())
    ;
  if (ch == '-') ch = getchar(), sgn = -1;
  for (; '0' <= ch && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  x *= sgn;
}
template <class T>
void write(T x) {
  if (x < 0)
    putchar('-'), write(-x);
  else if (x < 10)
    putchar(x + '0');
  else
    write(x / 10), putchar(x % 10 + '0');
}
struct edge {
  int id, to, nxt;
} graph[M];
int head[N], n, m, cnt = 0;
bool g[N][N];
void addedge(int id, int u, int v) {
  edge e = {id, v, head[u]};
  graph[head[u] = cnt++] = e;
}
int s, t, vis_mn[N][N], vis_mx[N][N], ans[M];
void dfs1(int u) {
  if (vis_mn[s][u]) return;
  vis_mn[s][u] = t;
  for (int i = head[u]; ~i; i = graph[i].nxt) {
    int v = graph[i].to;
    if (v == s) continue;
    dfs1(v);
  }
}
void dfs2(int u) {
  if (vis_mx[s][u]) return;
  vis_mx[s][u] = t;
  for (int i = head[u]; ~i; i = graph[i].nxt) {
    int v = graph[i].to;
    if (v == s) continue;
    dfs2(v);
  }
}
int main() {
  read(n), read(m);
  for (int i = 1; i <= n; i++) {
    head[i] = -1;
    for (int j = 1; j <= n; j++) g[i][j] = false;
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    read(u), read(v);
    addedge(i, u, v), g[u][v] = true;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) vis_mn[i][j] = vis_mx[i][j] = 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (g[i][j]) s = i, t = j, dfs1(j);
    }
    for (int j = n; j; j--) {
      if (g[i][j]) s = i, t = j, dfs2(j);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = head[i]; ~j; j = graph[j].nxt) {
      int u = i, v = graph[j].to;
      bool ans1 = vis_mn[v][u], ans2 = (vis_mn[u][v] < vis_mx[u][v]);
      ans[graph[j].id] = (ans1 == ans2);
    }
  }
  for (int i = 1; i <= m; i++) puts(ans[i] ? "same" : "diff");
  return 0;
}
