#include <bits/stdc++.h>
using namespace std;
int a[1001], b[200000], c[200000], d[200000], e[1001][1001], f[1001][1001], m,
    n;
bool x[1001];
inline bool cmp(int u, int v) {
  return b[u] == b[v] ? c[u] < c[v] : b[u] < b[v];
}
void dfs(int u, int* w) {
  for (int i = a[u - 1]; i < a[u]; i++)
    if (!w[b[i]]) w[b[i]] = w[u], dfs(b[i], w);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) scanf("%d%d", b + i, c + i), a[b[d[i] = i]]++;
  sort(d, d + m, cmp);
  for (int i = 1; i <= n; i++) a[i] += a[i - 1], e[i][i] = f[i][i] = -1;
  for (int i = 0; i < m; i++) b[i] = c[d[i]];
  for (int i = 0; i < m; i++) c[i] = d[i];
  for (int i = 1; i <= n; i++)
    for (int j = a[i - 1]; j < a[i]; j++)
      if (!e[i][b[j]]) dfs(e[i][b[j]] = b[j], e[i]);
  for (int i = 1; i <= n; i++)
    for (int j = a[i]; a[i - 1] < j--;)
      if (!f[i][b[j]]) dfs(f[i][b[j]] = b[j], f[i]);
  for (int i = 1; i <= n; i++)
    for (int j = a[i - 1]; j < a[i]; j++)
      x[c[j]] = (bool)e[b[j]][i] ^ e[i][b[j]] == f[i][b[j]];
  for (int i = 0; i < m; i++) puts(x[i] ? "same" : "diff");
  return 0;
}
