#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10, maxm = 2e5 + 10;
int n, m;
int head[maxn], nxt[maxm], to[maxm], tot;
int x[maxm], v[maxn][maxn], y[maxm], vis[maxn], vis2[maxn];
int s[maxm], S;
void add(int x, int y) {
  ++tot;
  nxt[tot] = head[x];
  to[tot] = y;
  head[x] = tot;
}
void dfs(int x, int y) {
  v[y][x] = 1;
  for (int e = head[x]; e; e = nxt[e]) {
    int z = to[e];
    if (!v[y][z]) dfs(z, y);
  }
}
void dfs2(int u, int *vis) {
  if (!vis[u]) vis[u] = u;
  for (int e = head[u]; e; e = nxt[e]) {
    int v = to[e];
    if (!vis[v]) {
      vis[v] = vis[u];
      dfs2(v, vis);
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  int a, b;
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &a, &b);
    add(a, b);
  }
  for (int i = 1; i <= n; ++i) {
    dfs(i, i);
  }
  for (int i = 1; i <= n; ++i) {
    memset(vis, 0, sizeof(vis));
    memset(vis2, 0, sizeof(vis2));
    vis[i] = vis2[i] = i;
    S = 0;
    for (int e = head[i]; e; e = nxt[e]) {
      s[S++] = e;
      int j = to[e];
      if (!vis[j]) dfs2(j, vis);
    }
    while (S) {
      int e = s[--S];
      int j = to[e];
      if (!vis2[j]) dfs2(j, vis2);
      if (vis2[j] == vis[j])
        y[e] = false;
      else
        y[e] = true;
      if (v[j][i])
        x[e] = true;
      else
        x[e] = false;
    }
  }
  for (int i = 1; i <= m; ++i) {
    puts(x[i] ^ y[i] ? "diff" : "same");
  }
}
