#include <bits/stdc++.h>
using namespace std;
int n, m;
struct edge {
  int from;
  int to;
  int next;
} E[200005];
int sz = 0;
int head[1005];
void add_edge(int u, int v) {
  sz++;
  E[sz].from = u;
  E[sz].to = v;
  E[sz].next = head[u];
  head[u] = sz;
}
int used[1005];
int route[1005][1005];
void dfs(int s, int x) {
  used[x] = 1;
  route[s][x]++;
  for (int i = head[x]; i; i = E[i].next) {
    int y = E[i].to;
    if (y == s) continue;
    if (!used[y] && route[s][y] < 2) {
      dfs(s, y);
    }
  }
}
int judge(int u, int v) {
  if (route[v][u] > 0) {
    if (route[u][v] >= 2)
      return 0;
    else
      return 1;
  } else {
    if (route[u][v] >= 2)
      return 1;
    else
      return 0;
  }
}
int main() {
  scanf("%d %d", &n, &m);
  int u, v;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &u, &v);
    add_edge(u, v);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = head[i]; j; j = E[j].next) {
      int y = E[j].to;
      if (route[i][y] < 2) {
        memset(used, 0, sizeof(used));
        dfs(i, y);
      }
    }
  }
  for (int i = 1; i <= m; i++) {
    if (judge(E[i].from, E[i].to))
      printf("diff\n");
    else
      printf("same\n");
  }
}
