#include <bits/stdc++.h>
using namespace std;
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v) is >> x;
  return is;
}
ostream& operator<<(ostream& os, const pair<char, int>& unit) {
  return os << unit.first << "^" << unit.second;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i) os << ' ' << v[i];
  }
  return os;
}
const int N = 1010;
int n, m;
int eu[N], ev[N];
bool vis[N];
vector<pair<int, int>> g[N], ig[N];
bool ans[N];
void reachable(int u) {
  vis[u] = true;
  for (const auto& pr : g[u])
    if (!vis[pr.first]) reachable(pr.first);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> eu[i] >> ev[i];
    g[eu[i]].emplace_back(ev[i], i);
    ig[ev[i]].emplace_back(eu[i], i);
  }
  for (int i = 1; i <= n; ++i) {
    for (int rep = 0; rep < 2; ++rep) {
      memset(vis, 0, sizeof(vis));
      vis[i] = true;
      for (const auto& pr : g[i])
        if (vis[pr.first])
          ans[pr.second] = true;
        else
          reachable(pr.first);
      reverse(g[i].begin(), g[i].end());
    }
  }
  for (int i = 1; i <= n; ++i) {
    memset(vis, 0, sizeof(vis));
    reachable(i);
    for (const auto& pr : ig[i]) {
      int j, id;
      tie(j, id) = pr;
      ans[id] ^= vis[j];
    }
  }
  for (int i = 1; i <= m; ++i) cout << (ans[i] ? "diff\n" : "same\n");
  return 0;
}
