#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;
using Weight = ll;
using Array = vector<ll>;
using Matrix = vector<vector<ll>>;
struct Edge {
  Edge() = default;
  Edge(const int src, const int dst, const ll weight)
      : src{src}, dst{dst}, weight{weight} {}
  int src;
  int dst;
  ll weight;
};
using Graph = vector<vector<Edge>>;
Graph cutTree(const Graph& g) {
  int n = g.size();
  Matrix capacity(n, Array(n)), flow(n, Array(n));
  for (int u = 0; u < n; u++) {
    for (const auto e : g[u]) {
      capacity[u][e.src] += e.weight;
    }
  }
  vector<int> p(n), prev;
  vector<Weight> w(n);
  for (int s = 1; s < n; ++s) {
    int t = p[s];
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) flow[i][j] = 0;
    Weight total = 0;
    while (1) {
      queue<int> Q;
      Q.push(s);
      prev.assign(n, -1);
      prev[s] = s;
      while (!Q.empty() && prev[t] < 0) {
        int u = Q.front();
        Q.pop();
        for (const auto& e : g[u])
          if (prev[e.dst] < 0 && (capacity[u][e.dst] - flow[u][e.dst]) > 0) {
            prev[e.dst] = u;
            Q.push(e.dst);
          }
      }
      if (prev[t] < 0) goto esc;
      Weight inc = INF<ll>;
      for (int j = t; prev[j] != j; j = prev[j])
        inc = min(inc, (capacity[prev[j]][j] - flow[prev[j]][j]));
      for (int j = t; prev[j] != j; j = prev[j])
        flow[prev[j]][j] += inc, flow[j][prev[j]] -= inc;
      total += inc;
    }
  esc:
    w[s] = total;
    for (int u = 0; u < n; u++)
      if (u != s && prev[u] != -1 && p[u] == t) p[u] = s;
    if (prev[p[t]] != -1) p[s] = p[t], p[t] = s, w[s] = w[t], w[t] = total;
  }
  Graph T(n);
  for (int s = 0; s < n; s++)
    if (s != p[s]) {
      T[s].push_back(Edge(s, p[s], w[s]));
      T[p[s]].push_back(Edge(p[s], s, w[s]));
    }
  return T;
}
Weight maximumFlow(const Graph& T, int u, int t, int p = -1,
                   Weight w = INF<ll>) {
  if (u == t) return w;
  Weight d = INF<ll>;
  for (const auto& e : T[u])
    if (e.dst != p) d = min(d, maximumFlow(T, e.dst, t, u, min(w, e.weight)));
  return d;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  using P = pair<int, int>;
  vector<P> edge(M);
  Graph g(N);
  for (int i = 0; i < M; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    g[u].push_back(Edge{u, v, 1});
    edge[i] = {u, v};
  }
  const auto tree = cutTree(g);
  for (int i = 0; i < M; i++) {
    const int u = edge[i].first;
    const int v = edge[i].second;
    const ll stcut = maximumFlow(tree, u, v);
    const ll tscut = maximumFlow(tree, v, u);
    cout << (tscut > 0 and stcut > 1 ? "same" : "diff") << endl;
  }
  return 0;
}
