#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int e, n;
} e[200010];
int hd[1010], cnt;
void add(int a, int b) {
  e[++cnt].e = b;
  e[cnt].n = hd[a];
  hd[a] = cnt;
}
int a[200010], b[200010], id[200010], ban[200010], vis[1010];
int connected(int a, int b) {
  int i;
  vis[a] = 1;
  if (a == b) return 1;
  for (i = hd[a]; i; i = e[i].n) {
    int q = e[i].e;
    if (!ban[i] && !vis[q] && connected(q, b)) return 1;
  }
  return 0;
}
int main() {
  int i, j, n, m;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &a[i], &b[i]);
    add(a[i], b[i]);
    id[i] = cnt;
  }
  for (i = 1; i <= m; i++) {
    for (j = 1; j <= n; j++) vis[j] = 0;
    int x = connected(b[i], a[i]);
    ban[id[i]] = 1;
    for (j = 1; j <= n; j++) vis[j] = 0;
    int y = connected(a[i], b[i]);
    ban[id[i]] = 0;
    if (x ^ y)
      printf("diff\n");
    else
      printf("same\n");
  }
  return 0;
}
