#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast")
namespace chtholly {
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar()) f ^= c == '-';
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ '0');
  return f ? x : -x;
}
template <typename mitsuha>
inline bool read(mitsuha &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  for (; !isdigit(c) && ~c; c = getchar()) f ^= c == '-';
  if (!~c) return 0;
  for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ '0');
  return x = f ? x : -x, 1;
}
template <typename mitsuha>
inline int write(mitsuha x, int b = 10) {
  if (!x) return 0 & putchar(48);
  if (x < 0) x = -x, putchar('-');
  int bit[99], i, p = 0;
  for (; x; x /= b) bit[++p] = x % b;
  for (i = p; i; --i) putchar(bit[i] + (bit[i] < 10 ? 48 : 55));
  return 0;
}
template <typename mitsuha>
inline int rwrite(mitsuha x, int b = 10) {
  mitsuha ans = 0, d = 1;
  for (; x; x /= 10, d *= b) ans = ans + x % 10 * d;
  return ans;
}
inline char fuhao() {
  char c = getchar();
  for (; isspace(c); c = getchar())
    ;
  return c;
}
}  // namespace chtholly
using namespace chtholly;
using namespace std;
const int yuzu = 2e5;
typedef int fuko[yuzu | 10];
vector<int> lj[yuzu | 10];
struct edge {
  int u, v;
} eg[yuzu | 10];
int cnt[1010][1011], vis[1010], can[1010][1010];
void dfs(int p, int u) {
  vis[u] = 1, cnt[p][u]++;
  for (int i : lj[u])
    if (!vis[i]) dfs(p, i);
}
void dfs2(int p, int u) {
  vis[u] = 1, can[p][u] = 1;
  for (int v : lj[u])
    if (!vis[v]) dfs2(p, v);
}
int main() {
  int i, n = read(), m = read();
  for (i = 1; i <= m; ++i) {
    int u = read(), v = read();
    lj[u].push_back(v);
    eg[i] = edge{u, v};
  }
  for (i = 1; i <= n; ++i) {
    for (int j : lj[i]) {
      memset(vis, 0, sizeof vis);
      vis[i] = 1, dfs(i, j);
    }
  }
  for (i = 1; i <= n; ++i) {
    memset(vis, 0, sizeof vis);
    dfs2(i, i);
  }
  for (i = 1; i <= m; ++i) {
    int u = eg[i].u, v = eg[i].v;
    puts(((cnt[u][v] == 1) ^ (!can[v][u])) ? "diff" : "same");
  }
}
