#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << '\n';
  err(++it, args...);
}
template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &a) {
  return os << '(' << a.first << ", " << a.second << ')';
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &a) {
  os << '[';
  for (unsigned int i = 0; i < a.size(); i++)
    os << a[i] << (i < a.size() - 1 ? ", " : "");
  os << ']';
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &a) {
  os << '{';
  for (typename set<T>::iterator it = a.begin(); it != a.end(); it++) {
    typename set<T>::iterator jt = it;
    os << *it << (++jt != a.end() ? ", " : "");
  }
  os << '}';
  return os;
}
template <class T1, class T2>
ostream &operator<<(ostream &os, map<T1, T2> &a) {
  os << "{\n";
  for (typename map<T1, T2>::iterator it = a.begin(); it != a.end(); it++) {
    typename map<T1, T2>::iterator jt = it;
    os << "  " << it->first << ": " << it->second
       << (++jt != a.end() ? ",\n" : "\n");
  }
  os << '}';
  return os;
}
int n, m;
vector<vector<pair<int, int> > > a(1005);
int cnt[1005][1005];
int mark[1005][1005];
bool ansOrder[200005];
void dfs(int u, int p, const int root, const int source) {
  if (u == root) return;
  if (cnt[root][u] >= 2) return;
  if (cnt[root][u] == 1 && mark[root][u] == source) return;
  cnt[root][u]++;
  mark[root][u] = source;
  for (auto it : a[u]) {
    int v = it.first;
    if (v == p) continue;
    dfs(v, u, root, source);
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = (signed)(1); i <= (signed)(m); i++) {
    int u, v;
    cin >> u >> v;
    a[u].push_back(make_pair(v, i));
  }
  for (int u = (signed)(1); u <= (signed)(m); u++) {
    for (auto it : a[u]) {
      int v = it.first;
      dfs(v, u, u, v);
    }
  }
  for (int u = (signed)(1); u <= (signed)(m); u++) {
    for (auto it : a[u]) {
      int v = it.first;
      bool diff = false;
      if (cnt[u][v] >= 2) {
        if (cnt[v][u] == 0) diff = true;
      } else if (cnt[u][v] == 1) {
        if (cnt[v][u] >= 1) diff = true;
      }
      ansOrder[it.second] = diff;
    }
  }
  for (int i = (signed)(1); i <= (signed)(m); i++) {
    if (ansOrder[i] == false)
      cout << "same" << '\n';
    else
      cout << "diff" << '\n';
  }
}
