#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void chkmax(T &a, T b) {
  if (a < b) a = b;
}
inline int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') ch = getchar(), f = -1;
  while (isdigit(ch)) s = s * 10 + ch - '0', ch = getchar();
  return ~f ? s : -s;
}
const int maxn = 1e3 + 20;
struct node {
  int v, next;
};
node e[200020];
int cnt, start[maxn];
inline void addedge(int u, int v) {
  e[++cnt] = (node){v, start[u]};
  start[u] = cnt;
}
int n, m;
int f[maxn][maxn];
int rt, D;
int g[maxn][maxn];
int vis[maxn];
int A[maxn], B[maxn];
int graph[maxn][maxn];
void dfs(int u) {
  f[rt][u] = 1;
  for (int i = start[u]; i; i = e[i].next) {
    int v = e[i].v;
    if (f[rt][v]) continue;
    dfs(v);
  }
}
struct Edge {
  int u, v;
};
Edge E[200020];
void dfs1(int u) {
  vis[u] = D;
  for (int i = start[u]; i; i = e[i].next) {
    int v = e[i].v;
    if (vis[v]) continue;
    dfs1(v);
  }
}
inline void init() {
  n = read();
  m = read();
  for (int i = (1), _end_ = (m); i <= _end_; i++) {
    int u = read(), v = read();
    E[i] = (Edge){u, v};
    addedge(u, v);
    graph[u][v] = 1;
  }
  for (int u = (1), _end_ = (n); u <= _end_; u++) {
    rt = u;
    dfs(u);
  }
  for (int u = (1), _end_ = (n); u <= _end_; u++) {
    static int st[maxn], top;
    top = 0;
    for (int i = start[u]; i; i = e[i].next) st[++top] = e[i].v;
    memset(vis, 0, sizeof(int) * (n + 1));
    vis[u] = top + 1;
    for (int j = (1), _end_ = (top); j <= _end_; j++) {
      D = j;
      if (!vis[st[j]]) dfs1(st[j]);
    }
    memcpy(A, vis, sizeof(int) * (n + 1));
    memset(vis, 0, sizeof(int) * (n + 1));
    vis[u] = top + 1;
    for (int j = (top), _end_ = (1); j >= _end_; j--) {
      D = j;
      if (!vis[st[j]]) dfs1(st[j]);
    }
    memcpy(B, vis, sizeof(int) * (n + 1));
    for (int j = (1), _end_ = (top); j <= _end_; j++)
      if (A[st[j]] != B[st[j]]) g[u][st[j]] = 1;
  }
}
inline void doing() {
  for (int i = (1), _end_ = (m); i <= _end_; i++) {
    int u = E[i].u, v = E[i].v;
    if (f[v][u] ^ (g[u][v]))
      puts("diff");
    else
      puts("same");
  }
}
int main() {
  init();
  doing();
  return 0;
}
