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