#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10, maxm = 2e5 + 10;
int n, m;
vector<int> g[maxn];
int a[maxm], b[maxm];
int v[maxn][maxn], w[maxn][maxn], vis2[maxn];
int rt;
inline void add(int a, int b) { g[a].push_back(b); }
inline int read() {
  int ans = 0, f = 1;
  char c = getchar();
  while (c > '9' || c < '0') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    ans = (ans << 1) + (ans << 3) + (c ^ 48), c = getchar();
  return ans * f;
}
inline void dfs2(int u) {
  v[rt][u] = vis2[u] = 1;
  for (auto y : g[u]) {
    if (!vis2[y]) dfs2(y);
  }
}
int main() {
  n = read(), m = read();
  for (int i = 1; i <= m; ++i) {
    a[i] = read(), b[i] = read();
    add(a[i], b[i]);
  }
  for (rt = 1; rt <= n; ++rt) {
    memset(vis2, 0, sizeof(vis2));
    vis2[rt] = 1;
    for (auto x : g[rt]) {
      if (!vis2[x])
        dfs2(x);
      else
        w[rt][x] = 1;
    }
    memset(vis2, 0, sizeof(vis2));
    reverse(g[rt].begin(), g[rt].end());
    for (auto x : g[rt]) {
      if (!vis2[x])
        dfs2(x);
      else
        w[rt][x] = 1;
    }
  }
  for (int i = 1; i <= m; ++i) {
    puts(v[b[i]][a[i]] ^ w[a[i]][b[i]] ? "diff" : "same");
  }
}
