#include <bits/stdc++.h>
using namespace std;
struct bian {
  int nxt, to;
} bi[200020];
int n, m, head[1010], num, b[200020][2];
inline void add(int from, int to) {
  bi[++num] = bian{head[from], to};
  head[from] = num;
}
bool vis[1010], f[200020][2];
int q[1010], h, t, l[1010], r[1010];
int st[1010], tp;
void work(int v) {
  tp = 0;
  for (int i = head[v]; i; i = bi[i].nxt) st[++tp] = bi[i].to;
  int x, y;
  memset(vis + 1, 0, n);
  vis[v] = 1;
  for (int i = 1; i <= tp; ++i)
    if (!vis[x = st[i]]) {
      h = 0, t = 1, q[t] = x, vis[x] = 1, l[x] = i;
      while (h < t) {
        x = q[++h];
        for (int j = head[x]; j; j = bi[j].nxt) {
          y = bi[j].to;
          if (!vis[y]) vis[y] = 1, q[++t] = y, l[y] = i;
        }
      }
    }
  memset(vis + 1, 0, n);
  vis[v] = 1;
  for (int i = tp; i; --i)
    if (!vis[x = st[i]]) {
      h = 0, t = 1, q[t] = x, vis[x] = 1, r[x] = i;
      while (h < t) {
        x = q[++h];
        for (int j = head[x]; j; j = bi[j].nxt) {
          y = bi[j].to;
          if (!vis[y]) vis[y] = 1, q[++t] = y, r[y] = i;
        }
      }
    }
  for (int i = head[v]; i; i = bi[i].nxt) f[i][0] = l[bi[i].to] != r[bi[i].to];
}
int main() {
  scanf("%d %d", &n, &m);
  int x, y;
  for (int i = 1; i <= m; ++i)
    scanf("%d %d", &x, &y), add(x, y), b[i][0] = x, b[i][1] = y;
  for (int i = 1; i <= n; ++i) {
    memset(vis + 1, 0, n);
    h = 0, t = 1;
    q[t] = i;
    vis[i] = 1;
    while (h < t) {
      x = q[++h];
      for (int j = head[x]; j; j = bi[j].nxt) {
        y = bi[j].to;
        if (!vis[y]) vis[y] = 1, q[++t] = y;
      }
    }
    for (int j = 1; j <= m; ++j)
      if (b[j][1] == i) f[j][1] = vis[b[j][0]];
  }
  for (int i = 1; i <= n; ++i) work(i);
  for (int i = 1; i <= m; ++i)
    if (f[i][0] != f[i][1])
      printf("diff\n");
    else
      printf("same\n");
  return 0;
}
