#include <bits/stdc++.h>
using namespace std;
int n, m;
int tot, fir[1010], nxt[200200], to[200200];
void addE(int u, int v) { nxt[++tot] = fir[u], fir[u] = tot, to[tot] = v; }
queue<int> q;
void bfs(int s, int mark, int *vis) {
  q.push(s), vis[s] = mark;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = fir[u], v; i; i = nxt[i]) {
      v = to[i];
      if (vis[v]) continue;
      vis[v] = mark, q.push(v);
    }
  }
}
int vis[1010][1010], v1[1010], v2[1010], ans[1010], stk[1010], top;
int main() {
  cin >> n >> m;
  for (int i = 1, u, v; i <= m; ++i) scanf("%d%d", &u, &v), addE(u, v);
  for (int i = 1; i <= n; ++i) bfs(i, 1, vis[i]);
  for (int u = 1; u <= n; ++u) {
    memset(v1, 0, sizeof v1);
    memset(v2, 0, sizeof v2);
    top = 0;
    for (int i = fir[u]; i; i = nxt[i]) stk[++top] = to[i];
    for (int i = 1, v; i <= top; ++i)
      if (!v1[v = stk[i]]) v1[u] = i, bfs(v, v, v1);
    for (int i = top, v; i >= 1; --i)
      if (!v2[v = stk[i]]) v2[u] = i, bfs(v, v, v2);
    for (int i = fir[u], v; i; i = nxt[i])
      v = to[i], ans[i] = (vis[v][u] == (v1[v] != v2[v]));
  }
  for (int i = 1; i <= m; ++i) puts(ans[i] ? "same" : "diff");
  return 0;
}
