#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
inline unsigned int R() {
  static unsigned int seed = 416;
  return seed ^= seed >> 5, seed ^= seed << 17, seed ^= seed >> 13;
}
const int N = 1020, M = 203000, inf = 0x3f3f3f3f;
int n, m, head[N], nxt[M], to[M], edgenum, a[M], b[M], d[N], mx[N], res[M];
vector<int> e[N];
void add(int u, int v) {
  to[++edgenum] = v;
  nxt[edgenum] = head[u];
  head[u] = edgenum;
}
inline void dfs(int u, int *d) {
  for (register int i = head[u]; i; i = nxt[i])
    if (d[to[i]] == inf) d[to[i]] = d[u], dfs(to[i], d);
}
int main() {
  read(n);
  read(m);
  for (register int i = (1); i <= (m); i++)
    read(a[i]), read(b[i]), add(a[i], b[i]), e[b[i]].push_back(i);
  for (register int u = (1); u <= (n); u++) {
    memset(d, inf, sizeof(d));
    memset(mx, inf, sizeof(mx));
    d[u] = mx[u] = 0;
    static int s[N];
    int len = 0;
    for (register int i = head[u]; i; i = nxt[i]) s[++len] = to[i];
    for (register int i = (1); i <= (len); i++)
      if (d[s[i]] == inf) d[s[i]] = s[i], dfs(s[i], d);
    for (register int i = (len); i >= (1); i--)
      if (mx[s[i]] == inf) mx[s[i]] = s[i], dfs(s[i], mx);
    for (register int i = head[u]; i; i = nxt[i])
      res[i] ^= d[to[i]] != to[i] || mx[to[i]] != to[i];
    for (register int i = (((int)e[u].size()) - 1); i >= (0); i--)
      res[e[u][i]] ^= d[a[e[u][i]]] < inf;
  }
  for (register int i = (1); i <= (m); i++)
    printf("%s\n", res[i] ? "diff" : "same");
  return 0;
}
