#include <bits/stdc++.h>
using std::cerr;
using std::endl;

const int N = 1e3 + 5, M = 2e5 + 5;

int n, m, ban;
struct Edge { int x, y; } E[M];
bool A[N][N], B[N][N];
std::vector<int> G[N];
int que[N], ql, qr;
int vis[N], tag[N], ver;

inline void bfs1(int st) {
  que[ql = qr = 0] = st;
  vis[st] = 1;
  while (ql <= qr) {
    int x = que[ql++];
    for (int y : G[x])
      if (!vis[y]) {
        vis[y] = 1;
        que[++qr] = y;
      }
  }
  for (int i = 1; i <= n; ++i)
    A[st][i] = vis[i], vis[i] = 0;
}

inline void bfs2(int st) {
  ++ver, tag[st] = ver;
  ++vis[st];
  que[ql = qr = 0] = st;
  while (ql <= qr) {
    int x = que[ql++];
    for (int y : G[x])
      if (vis[y] < 2 && tag[y] != ver) {
        ++vis[y];
        tag[y] = ver;
        que[++qr] = y;
      }
  }
}

int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1, x, y; i <= m; ++i) {
    scanf("%d %d", &x, &y);
    E[i] = { x, y };
    G[x].push_back(y);
  }
  for (int i = 1; i <= n; ++i)
    bfs1(i);
  for (int i = 1; i <= n; ++i) {
    memset(vis, 0, sizeof(vis));
    vis[i] = 233;
    for (int j : G[i])
      if (vis[j] < 2)
        bfs2(j);
    for (int j = 1; j <= n; ++j)
      if (vis[j] >= 2)
        B[i][j] = 1;
  }
  for (int i = 1; i <= m; ++i) {
    int x = E[i].x, y = E[i].y,
        cnt = A[y][x] + B[x][y];
    puts(cnt == 1 ? "diff" : "same");
  }
  return 0;
}

