#include <bits/stdc++.h>
using namespace std;
set<int> g[1000];
bool vis[1000];
bool dfs(int s, int e) {
  vis[s] = true;
  for (int n : g[s]) {
    if (n == e) {
      return true;
    }
    if (!vis[n] && dfs(n, e)) {
      return true;
    }
  }
  return false;
}
int main(int argc, char *argv[]) {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int> > e;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    g[a - 1].insert(b - 1);
    e.push_back(pair<int, int>(a - 1, b - 1));
  }
  for (int i = 0; i < m; ++i) {
    g[e[i].first].erase(e[i].second);
    fill(vis, vis + n, false);
    bool ab = dfs(e[i].first, e[i].second);
    fill(vis, vis + n, false);
    bool ba = dfs(e[i].second, e[i].first);
    cout << (ab == ba ? "same" : "diff") << endl;
    g[e[i].first].insert(e[i].second);
  }
}
