#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
const int INF = 0x3f3f3f3f;
const int N = 1e3 + 10, M = 2e5 + 10;
struct node {
  int x, y;
} G[M];
int to[M], nex[M], beg[N], cnt[N][N], vis[N];
int e;
inline int read() {
  int x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') flag = -1, ch = getchar();
  while (isdigit(ch)) x = (x << 3) + (x << 1) + (ch - '0'), ch = getchar();
  return x * flag;
}
inline void add(int x, int y) { to[++e] = y, nex[e] = beg[x], beg[x] = e; }
inline void dfs(int St, int cur, int To) {
  if (St == cur || vis[cur] == To || cnt[St][cur] >= 2) return;
  cnt[St][cur]++;
  if (cnt[St][cur] == 1) vis[cur] = To;
  for (int i = beg[cur]; i; i = nex[i]) dfs(St, to[i], To);
}
int main() {
  int n = read(), m = read();
  for (int i = (1), iend = (m); i <= iend; i++) {
    int x = read(), y = read();
    add(x, y), G[i] = (node){x, y};
  }
  for (int i = (1), iend = (n); i <= iend; i++) {
    memset(vis, 0, sizeof(vis));
    for (int j = beg[i]; j; j = nex[j]) dfs(i, to[j], to[j]);
  }
  for (int i = (1), iend = (m); i <= iend; i++) {
    if ((cnt[G[i].x][G[i].y] >= 2) ^ (cnt[G[i].y][G[i].x] >= 1))
      puts("diff");
    else
      puts("same");
  }
  return 0;
}
