#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n, m;
int hd[N], to[N * 200], pr[N * 200], tot;
void addedge(int u, int v) {
  to[tot] = v;
  pr[tot] = hd[u];
  hd[u] = tot;
}
int dfn[N], low[N], D, s[N], top;
bool in[N];
int cnt, sz[N], pos[N], tmp[N][N];
void dfs(int u) {
  low[u] = dfn[u] = ++D;
  s[++top] = u;
  in[u] = true;
  for (int i = hd[u]; i; i = pr[i])
    if (!dfn[to[i]]) {
      dfs(to[i]);
      low[u] = min(low[u], low[to[i]]);
    } else if (in[to[i]])
      low[u] = min(low[u], dfn[to[i]]);
  if (low[u] == dfn[u]) {
    ++cnt;
    int t;
    do {
      t = s[top--];
      tmp[cnt][++sz[cnt]] = t;
      pos[t] = cnt;
      in[t] = false;
    } while (t != u);
  }
}
bool ans[N * 200];
bitset<N> r[N];
int pp[N][N];
void work(int id) {
  if (in[id]) return;
  in[id] = true;
  for (int i = 1; i <= sz[id]; i++)
    for (int v, j = hd[tmp[id][i]]; j; j = pr[j])
      if (pos[v = to[j]] != id)
        work(pos[v]), r[id] = r[id] | r[pos[v]], pp[id][pos[v]]++;
  for (int i = 1; i <= sz[id]; i++)
    for (int v, j = hd[tmp[id][i]]; j; j = pr[j])
      if (pos[v = to[j]] != id) {
        if (pp[id][pos[v]] > 1 || r[id].test(pos[v])) ans[j] = true;
        r[id].set(pos[v]);
      }
}
int din[N], dout[N];
int o[N][N], I[N * 200];
int main() {
  scanf("%d%d", &n, &m);
  for (int u, v, i = 1; i <= m; i++) {
    ++tot;
    scanf("%d%d", &u, &v);
    if (!o[u][v]) {
      addedge(u, v);
      I[i] = o[u][v] = i;
    } else
      I[i] = o[u][v];
  }
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) dfs(i);
  memset(in, false, sizeof(in));
  for (int i = 1; i <= cnt; i++)
    if (!in[i]) work(i);
  for (int u = 1; u <= n; u++)
    for (int i = hd[u]; i; i = pr[i])
      if (pos[to[i]] == pos[u]) din[to[i]]++, dout[u]++;
  for (int u = 1; u <= n; u++)
    for (int i = hd[u]; i; i = pr[i])
      if (pos[to[i]] == pos[u])
        if (din[to[i]] == 1 || dout[u] == 1) ans[i] = true;
  for (int i = 1; i <= m; i++)
    if (ans[I[i]])
      puts("diff");
    else
      puts("same");
  return 0;
}
