#include <bits/stdc++.h>
using namespace std;
template <typename T>
void cmin(T &x, const T &y) {
  if (y < x) x = y;
}
template <typename T>
void cmax(T &x, const T &y) {
  if (y > x) x = y;
}
template <typename T>
void read(T &x) {
  x = 0;
  char c = getchar();
  bool f = 0;
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') f = 1, c = getchar();
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  if (f) x = -x;
}
const int MV = 1003;
const int ME = 200005;
int n, m;
int fst[MV], nxt[ME], u[ME], v[ME], lnum;
int way[MV][MV], dir[MV][MV];
void addeg(int nu, int nv) {
  nxt[++lnum] = fst[nu];
  fst[nu] = lnum;
  u[lnum] = nu;
  v[lnum] = nv;
}
void input() {
  read(n), read(m);
  for (int i = 1; i <= m; i++) {
    int a, b;
    read(a), read(b);
    dir[a][b]++;
    addeg(a, b);
  }
}
bool vis[MV];
void dfs(int x, int *s, int src, int len) {
  vis[x] = 1;
  if (len >= 2) s[x]++;
  for (int i = fst[x]; i; i = nxt[i])
    if (!vis[v[i]])
      if (!len || (len && !s[v[i]])) dfs(v[i], s, src, len + 1);
  vis[x] = 0;
}
void work() {
  for (int i = 1; i <= n; i++) dfs(i, way[i], i, 0);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) way[i][j] += dir[i][j];
  for (int i = 1; i <= m; i++) {
    int a = u[i], b = v[i];
    if (way[a][b] == 1 && !way[b][a])
      puts("same");
    else if (way[a][b] >= 2 && !way[b][a])
      puts("diff");
    else if (way[a][b] == 1 && way[b][a])
      puts("diff");
    else if (way[a][b] >= 2 && way[b][a])
      puts("same");
  }
}
int main() {
  input();
  work();
  return 0;
}
