#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int M = 2e6 + 3;
int to[M], nxt[M], from[M], head[N], cnt, n, m;
bool vis[N];
void add(int x, int y) {
  to[++cnt] = y;
  nxt[cnt] = head[x];
  head[x] = cnt;
  from[cnt] = x;
}
bool check(int From, int To, int ban) {
  memset(vis, 0, sizeof(vis));
  queue<int> que;
  que.push(From);
  vis[From] = 1;
  while (!que.empty()) {
    int x = que.front();
    que.pop();
    for (int i = head[x]; i; i = nxt[i])
      if (!vis[to[i]] && i != ban) {
        if (to[i] == To) return true;
        que.push(to[i]);
        vis[to[i]] = 1;
      }
  }
  return false;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
  }
  for (int i = 1; i <= m; i++) {
    if (check(from[i], to[i], i) ^ check(to[i], from[i], i))
      printf("diff\n");
    else
      printf("same\n");
  }
  return 0;
}
