#include <bits/stdc++.h>
using namespace std;
int n, m, tot, vis[1010], sz[1010], fr[1010], to[1010], th[1010][1010];
vector<int> v[1010];
int read() {
  int x = 0;
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return x;
}
void dfs(int x, int s, int cur) {
  if (vis[x] && (th[s][x] == -1 || th[s][x] == cur)) return;
  vis[x] = 1;
  if (!th[s][x])
    th[s][x] = cur;
  else if (cur != th[s][x])
    th[s][x] = -1;
  for (int i = 0; i < sz[x]; i++) dfs(v[x][i], s, cur);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, x, y; i <= m; i++) {
    scanf("%d%d", &fr[i], &to[i]);
    v[fr[i]].push_back(to[i]);
    sz[fr[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) vis[j] = 0;
    vis[i] = 1;
    th[i][i] = -1;
    for (int j = 0; j < sz[i]; j++) dfs(v[i][j], i, v[i][j]);
  }
  for (int i = 1; i <= m; i++) {
    int x = fr[i], y = to[i];
    if ((th[y][x] && th[x][y] != -1) || (!th[y][x] && th[x][y] == -1))
      puts("diff");
    else
      puts("same");
  }
}
