#include <bits/stdc++.h>
long long gi() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) f ^= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f ? x : -x;
}
std::mt19937 rnd(time(NULL));
template <class T>
void cxk(T& a, T b) {
  a = a > b ? a : b;
}
template <class T>
void cnk(T& a, T b) {
  a = a < b ? a : b;
}
int fir[1010], dis[200010], nxt[200010], id, ex[200010], ey[200010];
void link(int a, int b) { nxt[++id] = fir[a], fir[a] = id, dis[id] = b; }
int vis[1010][1010], que[1010], hd, tl, from[1010];
bool vv[1010];
int main() {
  int n = gi(), m = gi(), x, y;
  for (int i = 1; i <= m; ++i) ex[i] = x = gi(), ey[i] = y = gi(), link(x, y);
  for (int s = 1; s <= n; ++s) {
    int* v = vis[s];
    v[s] = 1;
    hd = tl = 0, que[tl++] = s;
    from[s] = 0;
    while (hd ^ tl) {
      int x = que[hd++];
      for (int i = fir[x]; i; i = nxt[i]) {
        if (!v[dis[i]])
          v[dis[i]] = 1, from[dis[i]] = (x == s ? dis[i] : from[x]),
          que[tl++] = dis[i];
        else if (from[x] != from[dis[i]])
          from[dis[i]] = -1;
      }
    }
    hd = tl = 0, que[tl++] = s;
    memset(vv, 0, sizeof vv);
    vv[s] = 1;
    while (hd ^ tl) {
      int x = que[hd++];
      for (int i = fir[x]; i; i = nxt[i]) {
        if (!vv[dis[i]]) vv[dis[i]] = 1, que[tl++] = dis[i];
        if (x != s && dis[i] != from[x]) ++v[dis[i]];
        if (x != s && from[x] != from[dis[i]]) from[dis[i]] = -1;
      }
    }
  }
  for (int i = 1; i <= m; ++i) {
    x = ex[i], y = ey[i];
    if (vis[y][x])
      puts(vis[x][y] == 1 ? "diff" : "same");
    else
      puts(vis[x][y] == 1 ? "same" : "diff");
  }
  return 0;
}
