#include <bits/stdc++.h>
using namespace std;
void read(int &x) {
  char ch = getchar();
  bool f = 0;
  x = 0;
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  if (f) x = -x;
}
void read(long long &x) {
  char ch = getchar();
  bool f = 0;
  x = 0;
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  if (f) x = -x;
}
struct graph_t {
  int front, nex;
} graph[201001];
int tail = 1000;
void addedge(int u, int v) {
  int tmp = graph[u].nex;
  graph[u].nex = ++tail;
  graph[tail].front = v;
  graph[tail].nex = tmp;
}
int vis[1001][1001];
pair<int, int> edge[200001];
int mark[1001];
int times = 1;
void dfs(int from, int now) {
  vis[from][now]++;
  mark[now] = times;
  for (int i = graph[now].nex; i; i = graph[i].nex) {
    if (now == from) continue;
    if (vis[from][graph[i].front] < 2 && mark[graph[i].front] != times) {
      dfs(from, graph[i].front);
    }
  }
}
int main() {
  int n, m;
  read(n);
  read(m);
  for (int i = 0; i < m; i++) {
    int from, to;
    read(from);
    read(to);
    addedge(from, to);
    edge[i] = make_pair(from, to);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = graph[i].nex; j; j = graph[j].nex) {
      if (vis[i][graph[j].front] < 2) {
        dfs(i, graph[j].front);
        times++;
      }
    }
  }
  for (int i = 0; i < m; i++) {
    int from = edge[i].first, to = edge[i].second;
    if (vis[to][from]) {
      if (vis[from][to] > 1) {
        puts("same");
      } else {
        puts("diff");
      }
    } else {
      if (vis[from][to] > 1) {
        puts("diff");
      } else {
        puts("same");
      }
    }
  }
  return 0;
}
