#include <bits/stdc++.h>
using namespace std;
inline long long ri() {
  long long x;
  scanf("%lld", &x);
  return x;
}
template <typename T>
inline bool smax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool smin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const int maxm = 1000010, maxn = 1003;
int idx[maxn], low[maxn], ins[maxn], vis[maxn], scc[maxn];
vector<int> g[maxn], gid[maxn];
pair<int, int> e[maxm];
int n, m;
int ec[maxn][maxn];
short viscnt[maxn];
int curidx = 1;
int scccnt = 0;
vector<int> tstask;
void dfs(int x) {
  low[x] = idx[x] = curidx++;
  tstask.push_back(x);
  ins[x] = 1;
  for (auto t : g[x]) {
    if (idx[t] == 0) {
      dfs(t);
      smin(low[x], low[t]);
    } else if (ins[t]) {
      smin(low[x], idx[t]);
    }
  }
  if (idx[x] == low[x]) {
    while (!tstask.empty() && tstask.back() != x) {
      int t = tstask.back();
      tstask.pop_back();
      ins[t] = 0;
      scc[t] = x;
    }
    ins[x] = 0;
    scc[x] = x;
    tstask.pop_back();
  }
}
bool direct[maxn];
int forbid = -1;
void run(int x) {
  for (auto t : g[x]) {
    if (direct[t]) {
      if (t != forbid) {
        viscnt[t] = 2;
      }
    } else if (!viscnt[t]) {
      viscnt[t] = 1;
      run(t);
    }
  }
}
int res[maxm];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    e[i] = pair<int, int>(u, v);
    g[u].push_back(v);
    gid[u].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    if (!idx[i]) {
      dfs(i);
    }
  }
  for (int i = 0; i < (m); i++) {
    ec[scc[e[i].first]][scc[e[i].second]]++;
  }
  for (int i = 0; i < (n); i++) {
    memset(viscnt, 0, sizeof viscnt);
    memset(direct, 0, sizeof direct);
    for (auto t : g[i]) {
      direct[t] = 1;
    }
    viscnt[i] = 1;
    for (auto t : g[i]) {
      forbid = t;
      run(t);
    }
    for (int j = 0; j < (g[i].size()); j++) {
      int d = gid[i][j];
      int u = i, v = g[i][j];
      if (scc[u] == scc[v]) {
        res[d] = viscnt[g[i][j]] <= 1;
      } else if (ec[scc[u]][scc[v]] == 1) {
        res[d] = viscnt[g[i][j]] > 1;
      } else {
        res[d] = 1;
      }
    }
  }
  for (int i = 0; i < (m); i++) {
    printf("%s\n", (res[i] ? "diff" : "same"));
  }
  return 0;
}
