#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int to, next, last;
} edge[200005];
int head[1005], tot, first[1005];
void addedge(int from, int to) {
  edge[++tot].to = to;
  if (head[from]) {
    edge[head[from]].last = tot;
  } else {
    first[from] = tot;
  }
  edge[tot].next = head[from];
  head[from] = tot;
}
int p1[1005][1005];
bool vis[1005];
void dfs1(int now, int p) {
  if (vis[now]) {
    return;
  }
  vis[now] = true;
  for (int i = head[now]; i; i = edge[i].next) {
    int v = edge[i].to;
    if (p1[p][v]) {
      continue;
    }
    p1[p][v] = now;
    dfs1(v, p);
  }
}
int p2[1005][1005];
void dfs2(int now, int p) {
  if (vis[now]) {
    return;
  }
  vis[now] = true;
  for (int i = first[now]; i; i = edge[i].last) {
    int v = edge[i].to;
    if (p2[p][v]) {
      continue;
    }
    p2[p][v] = now;
    dfs2(v, p);
  }
}
int u[200005], v[200005];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &u[i], &v[i]);
    addedge(u[i], v[i]);
  }
  for (int i = 1; i <= n; ++i) {
    memset(vis, 0, sizeof vis);
    dfs1(i, i);
    memset(vis, 0, sizeof vis);
    dfs2(i, i);
  }
  for (int i = 0; i < m; ++i) {
    int flag = 0;
    if (p1[v[i]][u[i]]) {
      flag ^= 1;
    }
    if (p1[u[i]][v[i]] != p2[u[i]][v[i]]) {
      flag ^= 1;
    }
    if (flag) {
      printf("diff\n");
    } else {
      printf("same\n");
    }
  }
}
