#include <bits/stdc++.h>
using namespace std;
int n, m, x[1200], y[1200], vis[2][1200][1200];
vector<int> vec[1200];
void dfs(int op, int o, int u, int k) {
  if (vis[op][o][u]) return;
  vis[op][o][u] = k;
  for (int i = 0; i < (int)vec[u].size(); ++i) dfs(op, o, vec[u][i], k);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x[i], &y[i]);
    vec[x[i]].push_back(y[i]);
  }
  for (int i = 1; i <= n; ++i) {
    vis[0][i][i] = vis[1][i][i] = 1;
    for (int j = 0; j < (int)vec[i].size(); ++j) dfs(0, i, vec[i][j], j + 1);
    if (vec[i].size())
      for (int j = (int)vec[i].size() - 1; j >= 0; --j)
        dfs(1, i, vec[i][j], j + 1);
  }
  for (int i = 1; i <= m; ++i) {
    int u = x[i], v = y[i];
    puts((vis[0][u][v] != vis[1][u][v]) ^ (vis[0][v][u]) ? "diff" : "same");
  }
  return 0;
}
