#include <bits/stdc++.h>
using namespace std;
namespace Solve {
inline void read(int &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= f;
}
int n, m, a, b;
int cnt;
int head[200200];
struct node {
  int to, next;
} edge[200200];
struct extra {
  int from, to;
} ignore[200200];
inline void add(int a, int b) {
  edge[++cnt].to = b, edge[cnt].next = head[a], head[a] = cnt;
}
int S;
int vis[1010][1010], f[1010][1010];
inline void dfs(int now, int fa) {
  vis[fa][now] = 1, ++f[S][now];
  for (register int i = head[now]; i; i = edge[i].next) {
    int to = edge[i].to;
    if (vis[now][to]) continue;
    dfs(to, now);
  }
}
inline void solve() {
  read(n), read(m);
  for (register int i = 1; i <= m; ++i) {
    int a, b;
    read(a), read(b);
    add(a, b), ignore[cnt].from = a, ignore[cnt].to = b;
  }
  for (register int i = 1; i <= n; ++i) {
    S = i;
    memset(vis, 0, sizeof(vis));
    dfs(S, S);
  }
  for (register int i = 1; i <= m; ++i) {
    int from = ignore[i].from, to = ignore[i].to;
    if (f[from][to] < 1 || f[to][from] < 1) {
      if (f[from][to] > 1) {
        cout << "diff" << endl;
      } else {
        cout << "same" << endl;
      }
    } else {
      if (f[from][to] > 1) {
        cout << "same" << endl;
      } else {
        cout << "diff" << endl;
      }
    }
  }
}
}  // namespace Solve
using namespace Solve;
int main() { solve(); }
