#include <bits/stdc++.h>
using namespace std;
int read() {
  char c = getchar();
  while (c < '0' || c > '9') {
    continue;
  }
  int num = c ^ 48;
  c = getchar();
  while (c >= '0' && c <= '9') {
    num = num * 10 + (c ^ 48);
    c = getchar();
  }
  return num;
}
vector<int> edge[1005];
int p1[1005][1005];
void dfs1(int now, int p) {
  for (vector<int>::iterator it = edge[now].begin(); it != edge[now].end();
       ++it) {
    int v = *it;
    if (p1[p][v]) {
      continue;
    }
    p1[p][v] = p1[p][now];
    dfs1(v, p);
  }
}
int p2[1005][1005];
void dfs2(int now, int p) {
  for (vector<int>::iterator it = edge[now].begin(); it != edge[now].end();
       ++it) {
    int v = *it;
    if (p2[p][v]) {
      continue;
    }
    p2[p][v] = p2[p][now];
    dfs2(v, p);
  }
}
int u[200005], v[200005];
int main() {
  int n, m;
  n = read();
  m = read();
  for (int i = 0; i < m; ++i) {
    u[i] = read();
    v[i] = read();
    edge[u[i]].push_back(v[i]);
  }
  for (int i = 1; i <= n; ++i) {
    p1[i][i] = i;
    for (vector<int>::iterator it = edge[i].begin(); it != edge[i].end();
         ++it) {
      int v = *it;
      if (p1[i][v]) {
        continue;
      }
      p1[i][v] = v;
      dfs1(v, i);
    }
    p2[i][i] = i;
    for (vector<int>::iterator it = --edge[i].end();; --it) {
      int v = *it;
      if (p2[i][v]) {
        if (it == edge[i].begin()) {
          break;
        }
        continue;
      }
      p2[i][v] = v;
      dfs2(v, i);
      if (it == edge[i].begin()) {
        break;
      }
    }
  }
  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");
    }
  }
}
