#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int to, next;
} edge[200005];
int head[1005], tot;
void addedge(int from, int to) {
  edge[++tot].to = to;
  edge[tot].next = head[from];
  head[from] = tot;
}
int p1[1005][1005];
void dfs1(int now, int p) {
  set<int> s;
  for (int i = head[now]; i; i = edge[i].next) {
    int v = edge[i].to;
    if (p1[p][v]) {
      continue;
    }
    s.insert(v);
  }
  for (set<int>::iterator it = s.begin(); it != s.end(); ++it) {
    int v = *it;
    if (p1[p][v]) {
      continue;
    }
    p1[p][v] = now;
    dfs1(v, p);
  }
}
int p2[1005][1005];
void dfs2(int now, int p) {
  set<int> s;
  for (int i = head[now]; i; i = edge[i].next) {
    int v = edge[i].to;
    if (p2[p][v]) {
      continue;
    }
    s.insert(-v);
  }
  for (set<int>::iterator it = s.begin(); it != s.end(); ++it) {
    int v = -*it;
    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) {
    p1[i][i] = i;
    dfs1(i, i);
    p2[i][i] = i;
    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");
    }
  }
}
