#include <bits/stdc++.h>
using namespace std;
long long read() {
  char ch = getchar();
  long long x = 0;
  int op = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') op = -1;
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 1) + ch - '0';
  return x * op;
}
int n, m, a[1005][1005], x[200005], y[200005], vis[1005];
vector<int> e[1005];
void dfs(int st, int u, int now) {
  if (st == u) return;
  if (a[st][u] >= 2) return;
  if (a[st][u] == 1 && vis[u] == now) return;
  if (a[st][u] == 0) vis[u] = now;
  a[st][u]++;
  for (int i = (0); i <= ((int)e[u].size() - 1); i++) dfs(st, e[u][i], now);
}
int main() {
  n = read();
  m = read();
  for (int i = (1); i <= (m); i++) {
    x[i] = read(), y[i] = read();
    e[x[i]].push_back(y[i]);
  }
  for (int i = (1); i <= (n); i++) {
    memset(vis, -1, sizeof(vis));
    for (int j = (0); j <= ((int)e[i].size() - 1); j++)
      dfs(i, e[i][j], e[i][j]);
  }
  for (int i = (1); i <= (m); i++) {
    bool f1 = a[y[i]][x[i]] >= 1;
    bool f2 = a[x[i]][y[i]] >= 2;
    if (f1 == f2)
      puts("same");
    else
      puts("diff");
  }
  return 0;
}
