#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], graph2[201001];
int tail = 1000, tail2 = 1000;
void addedge(int u, int v) {
  int tmp = graph[u].nex;
  graph[u].nex = ++tail;
  graph[tail].front = v;
  graph[tail].nex = tmp;
}
void addedge2(int u, int v) {
  int tmp = graph2[u].nex;
  graph2[u].nex = ++tail2;
  graph2[tail].front = v;
  graph2[tail].nex = tmp;
}
int vis[1001][1001];
pair<int, int> edge[200001];
set<pair<int, int> > visedge;
set<int> nowvis;
void dfs(int from, int now) {
  vis[from][now]++;
  nowvis.insert(now);
  for (int i = graph[now].nex; i; i = graph[i].nex) {
    if (!nowvis.count(graph[i].front) &&
        !visedge.count(make_pair(now, graph[i].front))) {
      visedge.insert(make_pair(now, graph[i].front));
      dfs(from, graph[i].front);
    }
  }
  nowvis.erase(now);
}
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++) {
    visedge.clear();
    dfs(i, i);
  }
  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;
}
