#include <bits/stdc++.h>
using namespace std;
const int N = 1005, M = 200005;
int n, m, sc, cc, non, wh[N], col[N];
bool vis[N], ans[M], shu[N], can[N];
pair<int, int> e[M];
vector<int> adj[N], rev[N], out[N], st;
void tdfs(int I) {
  if (vis[I]) return;
  vis[I] = true;
  for (auto &T : adj[I])
    if (T != non) tdfs(T);
  st.push_back(I);
}
void rdfs(int I) {
  if (vis[I]) return;
  wh[I] = sc;
  vis[I] = true;
  for (auto &T : rev[I])
    if (T != non) rdfs(T);
}
void toposort(int I) {
  non = I;
  sc = 0;
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) tdfs(i);
  }
  fill(vis + 1, vis + 1 + n, 0);
  while (!st.empty()) {
    int T = st.back();
    st.pop_back();
    if (!vis[T]) {
      rdfs(T);
      sc++;
    }
  }
  fill(vis + 1, vis + 1 + n, 0);
}
void cdfs(int I) {
  col[I] = cc;
  vis[I] = true;
  if (shu[I] && I != st[cc]) {
    can[I] = true;
    if (wh[I] == wh[st[cc]]) can[st[cc]] = true;
  }
  for (auto &T : adj[I]) {
    if (T == non) continue;
    if (vis[T]) {
      if (col[I] == col[T]) continue;
      if (wh[T] == wh[st[col[T]]]) can[st[col[T]]] = true;
    } else
      cdfs(T);
  }
}
void solve(int I) {
  toposort(I);
  for (auto &T : adj[I]) shu[T] = true;
  for (auto &T : adj[I]) {
    if (vis[T]) continue;
    st.push_back(T);
    cdfs(T);
    cc++;
  }
  for (auto &T : out[I]) {
    ans[T] = can[e[T].second];
  }
  cc = 0;
  st.clear();
  fill(vis + 1, vis + 1 + n, 0);
  fill(shu + 1, shu + 1 + n, 0);
  fill(can + 1, can + 1 + n, 0);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int A, B;
    scanf("%d%d", &A, &B);
    e[i] = {A, B};
    out[A].push_back(i);
    adj[A].push_back(B);
    rev[B].push_back(A);
  }
  for (int i = 1; i <= n; i++) {
    if (!out[i].empty()) solve(i);
  }
  toposort(0);
  for (int i = 1; i <= m; i++) {
    puts(ans[i] ^ (wh[e[i].first] == wh[e[i].second]) ? "diff" : "same");
  }
}
