#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int from;
  int to;
  int nxt;
} e[200005];
int n, m, edgenum, head[1005], minn[1005], maxx[1005], tmp[1005], top;
bool f1[1005][1005], f2[1005][1005];
bool flag[1005];
queue<int> q;
void add(int u, int v) {
  e[++edgenum].to = v;
  e[edgenum].from = u;
  e[edgenum].nxt = head[u];
  head[u] = edgenum;
}
void bfs(int s, bool* flag, int* a) {
  flag[s] = 1;
  a[s] = s;
  q.push(s);
  while (!q.empty()) {
    int node = q.front();
    q.pop();
    for (int hd = head[node]; hd; hd = e[hd].nxt) {
      int to = e[hd].to;
      if (!flag[to]) {
        flag[to] = 1;
        a[to] = s;
        q.push(to);
      }
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(u, v);
  }
  for (int i = 1; i <= n; i++) bfs(i, f1[i], tmp);
  for (int i = 1; i <= n; i++) {
    top = 0;
    for (int hd = head[i]; hd; hd = e[hd].nxt) tmp[++top] = e[hd].to;
    sort(tmp + 1, tmp + top + 1);
    memset(flag, 0, sizeof(flag));
    flag[i] = 1;
    for (int j = 1; j <= top; j++) {
      if (flag[tmp[j]]) continue;
      bfs(tmp[j], flag, minn);
    }
    memset(flag, 0, sizeof(flag));
    flag[i] = 1;
    for (int j = top; j >= 1; j--) {
      if (flag[tmp[j]]) continue;
      bfs(tmp[j], flag, maxx);
    }
    for (int j = 1; j <= top; j++) f2[i][tmp[j]] = minn[tmp[j]] < maxx[tmp[j]];
  }
  for (int i = 1; i <= m; i++) {
    int u = e[i].from, v = e[i].to;
    if (f1[v][u] ^ f2[u][v])
      puts("diff");
    else
      puts("same");
  }
  return 0;
}
