#include <bits/stdc++.h>
using namespace std;
const int oo = 2139063143;
const int N = 1010000;
const int P = 1000000007;
const double eps = 1e-7;
template <typename T>
inline void sc(T &x) {
  x = 0;
  static int p;
  p = 1;
  static char c;
  c = getchar();
  while (!isdigit(c)) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c - 48);
    c = getchar();
  }
  x *= p;
}
template <typename T>
inline void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
inline void pr(T x) {
  print(x), putchar('\n');
}
template <typename T1, typename T2>
void chkmax(T1 &A, T2 B) {
  A = A >= B ? A : B;
}
template <typename T1, typename T2>
void chkmin(T1 &A, T2 B) {
  A = A <= B ? A : B;
}
vector<pair<int, int> > G[N], T[N];
int n, m, ans[N], x[N], y[N];
bool vis[N];
void dfs0(int u) {
  vis[u] = 1;
  for (pair<int, int> x : G[u])
    if (!vis[x.first]) dfs0(x.first);
}
int p[N], q[N];
void dfs00(int u, int rt, bool fg) {
  if (!fg) {
    if (!p[u]) p[u] = rt;
  } else {
    if (!q[u]) q[u] = rt;
  }
  vis[u] = 1;
  for (pair<int, int> x : G[u])
    if (!vis[x.first]) dfs00(x.first, rt, fg);
}
int main() {
  sc(n), sc(m);
  for (int i = 1; i <= m; i++) {
    sc(x[i]), sc(y[i]);
    G[x[i]].push_back(make_pair(y[i], i));
    T[y[i]].push_back(make_pair(x[i], i));
  }
  for (int u = 1; u <= n; u++) {
    memset(vis, 0, sizeof(bool) * (n + 1));
    dfs0(u);
    for (pair<int, int> x : T[u])
      if (vis[x.first]) ans[x.second] = 1;
  }
  for (int u = 3; u <= n; u++) {
    memset(p, 0, sizeof(int) * (n + 1)), memset(q, 0, sizeof(int) * (n + 1));
    memset(vis, 0, sizeof(bool) * (n + 1)), vis[u] = 1;
    for (pair<int, int> x : G[u]) dfs00(x.first, x.first, 0);
    reverse(G[u].begin(), G[u].end());
    memset(vis, 0, sizeof(bool) * (n + 1)), vis[u] = 1;
    for (pair<int, int> x : G[u]) dfs00(x.first, x.first, 1);
    for (pair<int, int> x : G[u])
      if (p[x.first] != q[x.first]) ans[x.second] ^= 1;
  }
  for (int i = 1; i <= m; i++) puts(ans[i] ? "diff" : "same");
  return 0;
}
