#include <bits/stdc++.h>
const int N = 1054, M = 200054;
struct edge {
  int u, v;
  edge(int u0 = 0, int v0 = 0) : u(u0), v(v0) {}
} e[M];
int V, E, tag, root;
int first[N], next[M], from[N];
bool saturated[N], connected[N][N], reversible[N][N];
inline void addedge(int u, int v, int id) {
  e[id] = edge(u, v), next[id] = first[u], first[u] = id;
}
void dfs(int x) {
  if (saturated[x] || x == root || from[x] == tag) return;
  from[x] ? (saturated[x] = true) : (from[x] = tag);
  for (int i = first[x]; i; i = next[i]) dfs(e[i].v);
}
void solve() {
  int i;
  memset(saturated, false, V + 1);
  memset(from, 0, (V + 1) << 2);
  for (i = first[root]; i; i = next[i]) dfs(tag = e[i].v);
  for (i = 1; i <= V; ++i)
    if (i != root)
      connected[root][i] = saturated[i] || from[i],
      reversible[root][i] = saturated[i] || (from[i] && from[i] != i);
}
int main() {
  int i, u, v;
  scanf("%d%d", &V, &E);
  for (i = 1; i <= E; ++i) scanf("%d%d", &u, &v), addedge(u, v, i);
  for (root = 1; root <= V; ++root) solve();
  for (i = 1; i <= E; ++i)
    u = e[i].u, v = e[i].v,
    puts(connected[v][u] == reversible[u][v] ? "same" : "diff");
  return 0;
}
