#include <bits/stdc++.h>
using namespace std;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
class SCC {
 private:
  const int V;
  vector<vector<int> > G;
  vector<int> ord, low;
  stack<int> st;
  void dfs(const int u, int &tm) {
    ord[u] = low[u] = tm++, st.push(u);
    for (int v : G[u]) {
      if (ord[v] < 0) {
        dfs(v, tm);
        low[u] = min(low[u], low[v]);
      } else if (cmp[v] < 0) {
        low[u] = min(low[u], ord[v]);
      }
    }
    if (ord[u] == low[u]) {
      while (true) {
        const int v = st.top();
        st.pop();
        cmp[v] = cnt;
        if (v == u) break;
      }
      ++cnt;
    }
  }

 public:
  vector<vector<int> > graph;
  vector<int> cmp;
  int cnt;
  SCC(const int node_size)
      : V(node_size), G(V), ord(V, -1), low(V), cmp(V, -1), cnt(0) {}
  void add_edge(const int from, const int to) { G[from].push_back(to); }
  int solve() {
    int tm = 0;
    for (int i = 0; i < V; ++i) {
      if (ord[i] < 0) dfs(i, tm);
    }
    for (int i = 0; i < V; ++i) cmp[i] = cnt - 1 - cmp[i];
    return cnt;
  }
  void make_graph() {
    graph.resize(cnt);
    for (int i = 0; i < V; ++i) {
      for (int j : G[i]) {
        if (cmp[i] != cmp[j]) {
          graph[cmp[i]].push_back(cmp[j]);
        }
      }
    }
  }
};
using P = pair<int, int>;
vector<int> G[1001];
vector<P> bs;
int used[1001], val[1001];
int dfs(int v, int p) {
  int res = 0, cnt = 0;
  used[v] = 1;
  for (int w : G[v]) {
    if (w == v) {
      continue;
    }
    if (w == p) {
      if (cnt > 0) {
        res += 1;
        val[w] += 1;
      }
      ++cnt;
      continue;
    }
    if (!used[w]) {
      res += dfs(w, v);
    } else if (used[w] == 1) {
      res += 1;
      val[w] += 1;
    }
  }
  used[v] = 2;
  res -= val[v];
  if (p != -1 && res == 0) {
    bs.push_back(p < v ? P(p, v) : P(v, p));
  }
  return res;
}
void bridge() {
  bs.clear();
  for (int i = 0; i < 1001; ++i) used[i] = val[i] = 0;
  dfs(0, -1);
}
vector<vector<int> > g;
set<pair<int, int> > cb;
int psm[1001][1001];
void dfs2(int s, int id, set<int> &t) {
  t.insert(id);
  for (auto x : g[id]) {
    if (t.count(x)) continue;
    psm[s][x]++;
    if (psm[s][x] >= 3) continue;
    dfs2(s, x, t);
  }
  t.erase(id);
}
int main() {
  int n, m;
  cin >> n >> m;
  g.resize(n);
  SCC scc(n);
  vector<pair<int, int> > edge;
  for (int i = 0; i < (int)(m); ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    edge.push_back(make_pair(a, b));
    scc.add_edge(a, b);
  }
  int c = scc.solve();
  vector<int> cmp = scc.cmp;
  for (int i = 0; i < (int)(m); ++i) {
    int a = edge[i].first;
    int b = edge[i].second;
    if (cmp[a] != cmp[b]) {
      G[cmp[a]].push_back(cmp[b]);
    } else {
      g[a].push_back(b);
    }
  }
  bridge();
  for (auto x : bs) {
    cb.insert(x);
  }
  for (int i = 0; i < (int)(n); ++i) {
    psm[i][i] = 1;
    set<int> t;
    t.insert(i);
    dfs2(i, i, t);
  }
  for (auto x : edge) {
    int a = x.first;
    int b = x.second;
    if (cmp[a] != cmp[b]) {
      if (cb.count(make_pair(cmp[a], cmp[b]))) {
        cout << "same\n";
      } else {
        cout << "diff\n";
      }
    } else {
      if (psm[a][b] >= 2) {
        cout << "same\n";
      } else {
        cout << "diff\n";
      }
    }
  }
  return 0;
}
