#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int from, to, ne;
} edge[200010];
int head[1010], ne[200010], pre[200010], T, tot;
bool flag[1010][1010];
int f1[1010][1010], f2[1010][1010], vis[1010];
void add(int u, int v) {
  if (~ne[u])
    pre[ne[u]] = tot;
  else
    head[u] = tot;
  edge[tot] = {u, v, ne[u]};
  ne[u] = tot++;
}
void dfs1(int src, int u) {
  flag[src][u] = true;
  vis[u] = T;
  for (int i = ne[u]; ~i; i = edge[i].ne) {
    int v = edge[i].to;
    if (vis[v] != T) dfs1(src, v);
  }
}
void dfs2(int src, int exc, int u, int f[1010][1010]) {
  if (~f[exc][u]) return;
  f[exc][u] = src;
  vis[u] = T;
  for (int i = ne[u]; ~i; i = edge[i].ne) {
    int v = edge[i].to;
    if (vis[v] != T && v != exc) dfs2(src, exc, v, f);
  }
}
int main() {
  int n, m;
  memset(ne, -1, sizeof ne);
  memset(head, -1, sizeof head);
  memset(f1, -1, sizeof f1);
  memset(f2, -1, sizeof f2);
  scanf("%d%d", &n, &m);
  for (int i = (0); i < (m); ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(u, v);
  }
  for (int i = (1); i <= (n); ++i) {
    for (int j = ne[i]; ~j; j = edge[j].ne) {
      int v = edge[j].to;
      ++T;
      dfs2(j, i, edge[j].to, f1);
    }
    if (head[i] == -1) continue;
    for (int j = head[i];; j = pre[j]) {
      int v = edge[j].to;
      ++T;
      dfs2(j, i, edge[j].to, f2);
      if (j == ne[i]) break;
    }
  }
  for (int i = (0); i < (m); ++i) {
    int u = edge[i].from, v = edge[i].to;
    if (f1[u][v] != -1 ^ (f1[u][v] != i || f2[u][v] != i))
      puts("diff");
    else
      puts("same");
  }
  return 0;
}
