#include <bits/stdc++.h>
using namespace std;
const int N = 200200;
inline int read(int x = 0, bool f = 0, char ch = getchar()) {
  for (; !isdigit(ch); ch = getchar()) f = ch == '-';
  for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
  return f ? -x : x;
}
int n, m, tot, fi[N], to[N], u[N], ne[N];
bool vis[1010][1010];
int pre[1010][1010], suf[1010][1010];
void bfs(int x) {
  queue<int> s;
  s.push(x);
  vis[x][x] = true;
  while (!s.empty()) {
    int y = s.front();
    s.pop();
    for (int i = fi[y]; i; i = ne[i])
      if (!vis[x][to[i]]) vis[x][to[i]] = true, s.push(to[i]);
  }
}
void dfs1(int x, int id, int k) {
  pre[id][x] = k;
  for (int i = fi[x]; i; i = ne[i])
    if (!pre[id][x]) dfs1(to[i], id, k);
}
void dfs2(int x, int id, int k) {
  suf[id][x] = k;
  for (int i = fi[x]; i; i = ne[i])
    if (!suf[id][x]) dfs2(to[i], id, k);
}
int main() {
  n = read(), m = read();
  for (int i = 1, x, y; i <= m; ++i)
    x = read(), y = read(), ne[++tot] = fi[x], u[tot] = x, to[fi[x] = tot] = y;
  for (int i = 1; i <= n; ++i) bfs(i);
  for (int i = 1; i <= n; ++i) {
    vector<int> s;
    int sz = 0;
    pre[i][i] = suf[i][i] = 1;
    for (int j = fi[i]; j; j = ne[j]) s.push_back(to[j]);
    for (int j : s) {
      ++sz;
      if (!pre[i][j]) dfs1(j, i, sz);
    }
    reverse(s.begin(), s.end());
    for (int j : s) {
      if (!suf[i][j]) dfs2(j, i, sz);
      --sz;
    }
  }
  for (int i = 1; i <= m; ++i) {
    int x = u[i], y = to[i];
    if (vis[y][x] ^ (pre[x][y] != suf[x][y]))
      puts("diff");
    else
      puts("same");
  }
  return 0;
}
