#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
vector<int> graph[N];
int n, m, l[N], r[N], cnt[N][N], vis[N][N];
void dfs(int u, int p, int root, int mark) {
  if (u == p || u == root) return;
  if (cnt[root][u] >= 2) return;
  if (cnt[root][u] == 1 && vis[root][u] == mark) return;
  vis[root][u] = mark;
  cnt[root][u]++;
  for (int i = 0; i < graph[u].size(); i++) {
    int v = graph[u][i];
    if (v == p) continue;
    dfs(v, u, root, mark);
  }
}
int main() {
  cin.tie(0), ios::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> l[i] >> r[i];
    graph[l[i]].push_back(r[i]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < graph[i].size(); j++) {
      int v = graph[i][j];
      dfs(v, i, i, v);
    }
  }
  for (int i = 1; i <= m; i++) {
    if (cnt[l[i]][r[i]] >= 2) {
      if (cnt[r[i]][l[i]] == 0)
        cout << "diff\n";
      else
        cout << "same\n";
    } else {
      if (cnt[r[i]][l[i]] >= 1)
        cout << "diff\n";
      else
        cout << "same\n";
    }
  }
}
