#include <bits/stdc++.h>
std::pair<int, int> d[1010][2], q[1010 * 2];
int Ans[1010][1010], Ans2[1010][1010];
int hh = 0, tt = 0;
int x[201000], y[201000];
int h[1010], nxt[201000], to[201000], K = 0;
void ins(int u, int v) {
  nxt[++K] = h[u];
  h[u] = K;
  to[K] = v;
}
void bfs(int S) {
  hh = 0;
  tt = 0;
  memset(d, -1, sizeof(d));
  for (int i = h[S]; i; i = nxt[i])
    d[to[i]][0] = std::pair<int, int>(1, to[i]),
    q[tt++] = std::pair<int, int>(to[i], 0);
  while (hh < tt) {
    int u = q[hh].first, o = q[hh].second;
    hh++;
    for (int i = h[u]; i; i = nxt[i]) {
      if (to[i] == S) continue;
      if (d[to[i]][0].first == -1) {
        d[to[i]][0].first = d[u][o].first + 1;
        d[to[i]][0].second = d[u][o].second;
        q[tt++] = std::pair<int, int>(to[i], 0);
      } else if (d[to[i]][1].first == -1 &&
                 d[to[i]][0].second != d[u][o].second) {
        d[to[i]][1].first = d[u][o].first + 1;
        d[to[i]][1].second = d[u][o].second;
        q[tt++] = std::pair<int, int>(to[i], 1);
      }
    }
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x[i], &y[i]);
    ins(x[i], y[i]);
  }
  for (int i = 1; i <= n; i++) {
    bfs(i);
    for (int j = 1; j <= n; j++) {
      if (d[j][0].second != j)
        Ans[i][j] = d[j][0].first;
      else
        Ans[i][j] = d[j][1].first;
      Ans2[i][j] = d[j][0].first;
    }
  }
  for (int i = 1; i <= m; i++) {
    if (Ans[x[i]][y[i]] == -1 && Ans2[y[i]][x[i]] != -1 ||
        Ans[x[i]][y[i]] != -1 && Ans2[y[i]][x[i]] == -1)
      puts("diff");
    else
      puts("same");
  }
}
