#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int v, nxt;
} e[400010];
int tot;
int first[1010];
void build(int u, int v) {
  e[++tot] = (Edge){v, first[u]};
  first[u] = tot;
  return;
}
bool A[1010][1010], B[1010][1010];
void dfs1(int u, int o) {
  if (A[o][u]) return;
  A[o][u] = true;
  for (int i = first[u]; i; i = e[i].nxt) dfs1(e[i].v, o);
  return;
}
int book[1010];
bool vis[1010];
void dfs2(int u, int o, int s, bool ok = false) {
  if (vis[u]) return;
  vis[u] = true;
  if (!ok)
    book[u] = s;
  else
    B[o][u] = (s != book[u]);
  for (int i = first[u]; i; i = e[i].nxt) dfs2(e[i].v, o, s, ok);
  return;
}
int U[200010], V[200010];
int tmp[200010];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &U[i], &V[i]);
    build(U[i], V[i]);
  }
  for (int i = 1; i <= n; i++) dfs1(i, i);
  for (int i = 1; i <= n; i++) {
    memset(book, 0, sizeof(book));
    memset(vis, 0, sizeof(vis));
    int cnt = 0;
    vis[i] = true;
    for (int j = first[i]; j; j = e[j].nxt) {
      tmp[++cnt] = e[j].v;
      dfs2(e[j].v, i, cnt);
    }
    memset(vis, 0, sizeof(vis));
    vis[i] = true;
    for (int j = cnt; j >= 1; j--) dfs2(tmp[j], i, j, true);
  }
  for (int i = 1; i <= m; i++)
    if (A[V[i]][U[i]] ^ B[U[i]][V[i]])
      printf("diff\n");
    else
      printf("same\n");
  return 0;
}
