#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n, m;
int ans[N], t[N][N], tt[N], b[N * 200], a[N * 200];
int D, del, clk, vis[N];
void dfs(int u) {
  if (vis[u]) return;
  if (u == del) return;
  vis[u] = clk;
  for (int i = 1; i <= tt[u]; i++) dfs(b[t[u][i]]);
}
void work(int u) {
  del = u;
  memset(vis, 0, sizeof(vis));
  for (int v, i = 1; i <= tt[u]; i++) {
    clk = v = b[t[u][i]];
    dfs(v);
  }
  for (int v, i = 1; i <= tt[u]; i++) {
    v = b[t[u][i]];
    if (v != vis[v]) ans[t[u][i]] = 1;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int u, v, i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    a[i] = u, b[i] = v;
    t[u][++tt[u]] = i;
  }
  for (int u = 1; u <= n; u++) {
    work(u);
    for (int i = 1; i <= tt[u] / 2; i++) swap(t[u][i], t[u][tt[u] - i + 1]);
    work(u);
  }
  for (int u = 1; u <= n; u++) {
    memset(vis, 0, sizeof(vis));
    clk = 1;
    del = 0;
    dfs(u);
    for (int i = 1; i <= m; i++)
      if (b[i] == u) ans[i] ^= vis[a[i]];
  }
  for (int i = 1; i <= m; i++)
    if (ans[i])
      puts("diff");
    else
      puts("same");
  return 0;
}
