#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
const int maxm = 200010;
const int inf = 0x3f3f3f3f;
int l[maxn], e, ban_id;
struct Edge {
  int v, id, x;
} E[maxm];
int e_u[maxm], e_v[maxm], Q[maxn], vis[maxn], n, m;
int col[maxn], rt[maxn], dfn[maxn], low[maxn], sta[maxn], cnt, top, tim;
int fa[maxn][20], dep[maxn], mn_id[maxn], mx[maxn][maxn], ontree[maxm];
vector<int> G[maxn];
inline void addEdge(int u, int v, int id) {
  E[e].v = v, E[e].x = l[u], E[e].id = id, l[u] = e++;
}
void init_vis() {
  for (int i = 1; i <= n; i++) vis[i] = 0;
}
void dfs_calmx(int u) {
  for (int i = 1; i <= n; i++) mx[u][i] = -inf;
  mx[u][u] = 0;
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i];
    if (!vis[v]) dfs_calmx(v);
    for (int j = 1; j <= n; j++) mx[u][j] = max(mx[u][j], mx[v][j] + 1);
  }
}
int check(int a, int b) {
  init_vis();
  vis[a] = 1;
  int s = 0, t = 0;
  Q[t++] = a;
  while (s < t) {
    int u = Q[s++];
    if (u == b) return 1;
    for (int p = l[u]; p >= 0; p = E[p].x) {
      int v = E[p].v;
      if (E[p].id != ban_id && !vis[v]) {
        vis[v] = 1;
        Q[t++] = v;
      }
    }
  }
  return 0;
}
void tarjan(int u) {
  dfn[u] = low[u] = ++tim;
  sta[++top] = u;
  vis[u] = 1;
  for (int p = l[u]; p >= 0; p = E[p].x) {
    int v = E[p].v;
    if (!dfn[v]) {
      tarjan(v);
      low[u] = min(low[u], low[v]);
    } else if (vis[v]) {
      low[u] = min(low[u], dfn[v]);
    }
  }
  if (low[u] == dfn[u]) {
    int t = 0;
    rt[++cnt] = u;
    do {
      t = sta[top--];
      col[t] = cnt;
      vis[t] = 0;
    } while (t != u);
  }
}
void dfs_buildtree(int u, int f) {
  vis[u] = 1;
  fa[u][0] = f;
  for (int i = 1; i < 20; i++) fa[u][i] = fa[fa[u][i - 1]][i - 1];
  for (int p = l[u]; p >= 0; p = E[p].x) {
    int v = E[p].v;
    if (col[v] == col[u] && !vis[v]) {
      ontree[E[p].id] = 1;
      dep[v] = dep[u] + 1;
      dfs_buildtree(v, u);
    }
  }
}
int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  if (dep[u] > dep[v]) {
    int c = dep[u] - dep[v];
    for (int i = 0; i < 20; i++) {
      if (c & (1 << i)) {
        u = fa[u][i];
        v = fa[u][i];
      }
    }
  }
  if (u == v) return u;
  for (int i = 19; i >= 0; i--) {
    if (fa[u][i] != fa[v][i]) {
      u = fa[u][i];
      v = fa[v][i];
    }
  }
  return fa[u][0];
}
int main() {
  memset(l, -1, sizeof(l));
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    addEdge(u, v, i);
    e_u[i] = u, e_v[i] = v;
  }
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) tarjan(i);
  for (int i = 1; i <= m; i++) {
    int u = e_u[i], v = e_v[i];
    if (col[u] != col[v]) {
      G[col[u]].push_back(col[v]);
    }
  }
  init_vis();
  for (int i = 1; i <= cnt; i++) dfs_buildtree(rt[i], 0);
  init_vis();
  for (int i = 1; i <= cnt; i++)
    if (!vis[i]) dfs_calmx(i);
  for (int i = 1; i <= m; i++) {
    int u = e_u[i], v = e_v[i];
    if (col[u] == col[v]) {
      if (!mn_id[u] || dep[lca(u, v)] < dep[mn_id[u]]) mn_id[u] = i;
    }
  }
  for (int i = 1; i <= m; i++) {
    int u = e_u[i], v = e_v[i];
    if (col[u] != col[v]) {
      if (mx[col[u]][col[v]] > 1)
        puts("diff");
      else
        puts("same");
    } else {
      if (mn_id[u] != i && !ontree[i]) {
        puts("same");
      } else {
        ban_id = i;
        int t = check(u, v);
        if (t)
          puts("same");
        else
          puts("diff");
      }
    }
  }
  return 0;
}
