#include <bits/stdc++.h>
using namespace std;
int n, m, tot, head[1010], th[1010][1010];
bool vis[1010];
struct point {
  int fr, to, nxt;
} a[200100];
void add(int x, int y) {
  a[++tot].fr = x;
  a[tot].to = y;
  a[tot].nxt = head[x];
  head[x] = tot;
}
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 = head[x]; i; i = a[i].nxt) dfs(a[i].to, s, cur);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, x, y; i <= m; i++) {
    scanf("%d%d", &x, &y);
    add(x, y);
  }
  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 = head[i]; j; j = a[j].nxt) dfs(a[j].to, i, j);
  }
  for (int i = 1; i <= m; i++) {
    int x = a[i].fr, y = a[i].to;
    if ((th[y][x] && th[x][y] != -1) || (!th[y][x] && th[x][y] == -1))
      puts("diff");
    else
      puts("same");
  }
}
