#include <bits/stdc++.h>
const int N = 1003, M = 200005;
using namespace std;
int n, m, to[M], hd[M], lk[M], u, nl[N], nr[N], st[N], t;
bool mp[N][N], ans[M];
void dfs(int x) {
  if (mp[u][x]) return;
  mp[u][x] = 1;
  for (int i = lk[x]; i; i = hd[i]) dfs(to[i]);
}
void dfs(int x, int* a) {
  if (a[x] || x == u) return;
  a[x] = t;
  for (int i = lk[x]; i; i = hd[i]) dfs(to[i], a);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &u, to + i);
    hd[i] = lk[u], lk[u] = i;
  }
  for (int i = 1; i <= n; i++) dfs(u = i);
  for (int i = 1; i <= n; i++) {
    t = 0, u = i;
    for (int j = 1; j <= n; j++) nl[j] = nr[j] = 0;
    for (int j = lk[i]; j; j = hd[j]) dfs(to[st[++t] = j], nl);
    for (int s; t; t--)
      dfs(s = to[st[t]], nr), ans[st[t]] = mp[s][i] ^ (nl[s] < t || nr[s] > t);
  }
  for (int i = 1; i <= m; i++) puts(ans[i] ? "diff" : "same");
}
