#include <bits/stdc++.h>
using namespace std;
struct edg {
  int from, to, next;
} b[(200000 + 5)];
int g[(1000 + 5)], cntb, col[(1000 + 5)], n, m;
int g1[(1000 + 5)][(1000 + 5)], g2[(1000 + 5)][(1000 + 5)];
void adn(int from, int to) {
  b[++cntb].next = g[from];
  b[cntb].from = from;
  b[cntb].to = to;
  g[from] = cntb;
}
void dfs(int dq) {
  for (int i = g[dq]; i; i = b[i].next)
    if (!col[b[i].to]) col[b[i].to] = col[dq], dfs(b[i].to);
}
void init() {
  for (int i = 1; i <= n; i++) {
    memset(col, 0, sizeof(col));
    col[i] = 1;
    dfs(i);
    for (int j = 1; j <= n; j++)
      if (col[j]) g1[i][j] = 1;
  }
  for (int i = 1; i <= n; i++) {
    memset(col, 0, sizeof(col));
    col[i] = i;
    int t[(200000 + 5)], cc[(1000 + 5)];
    t[0] = 0;
    for (int j = g[i]; j; j = b[j].next) t[++t[0]] = j;
    for (int j = 1; j <= t[0]; j++)
      if (!col[b[t[j]].to]) col[b[t[j]].to] = j, dfs(b[t[j]].to);
    memcpy(cc, col, sizeof(int) * (n + 5));
    memset(col, 0, sizeof(col));
    col[i] = i;
    for (int j = t[0]; j; j--)
      if (!col[b[t[j]].to]) col[b[t[j]].to] = j, dfs(b[t[j]].to);
    for (int j = 1; j <= n; j++)
      if (col[j] != cc[j]) g2[i][j] = 1;
  }
}
pair<int, int> e[(200000 + 5)];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &e[i].first, &e[i].second);
    adn(e[i].first, e[i].second);
  }
  init();
  for (int i = 1; i <= m; i++) {
    if ((g1[e[i].second][e[i].first] && !g2[e[i].first][e[i].second]) xor
        (!g1[e[i].second][e[i].first] && g2[e[i].first][e[i].second]))
      puts("diff");
    else
      puts("same");
  }
  return 0;
}
