#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int M = 2e5 + 5;
vector<int> v[N];
bitset<N> vis;
int n, m, g1[N][N], g2[N][N], pre[N];
struct node {
  int x, y;
} e[M];
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
void dfs(int x, int now) {
  g1[now][x] = 1;
  vis.set(x);
  for (int i = 0; i < (int)v[x].size(); i++) {
    int y = v[x][i];
    if (vis[y]) continue;
    dfs(y, now);
  }
}
void dfs(int x, int id, int k, int now) {
  if (!k)
    pre[x] = id;
  else
    g2[now][x] = (pre[x] != id);
  vis.set(x);
  for (int i = 0; i < (int)v[x].size(); i++) {
    int y = v[x][i];
    if (vis[y]) continue;
    dfs(y, id, k, now);
  }
}
int main() {
  n = read();
  m = read();
  for (int i = 1, x, y; i <= m; i++) {
    x = read();
    y = read();
    v[x].push_back(y);
    e[i] = node{x, y};
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) vis[j] = 0;
    dfs(i, i);
  }
  for (int i = 1; i <= n; i++) {
    vis.reset();
    vis.set(i);
    for (int j = 1; j <= n; j++) pre[j] = 0;
    int d = v[i].size();
    for (int j = 0; j < d; j++)
      if (!vis[v[i][j]]) dfs(v[i][j], j + 1, 0, i);
    vis.reset();
    vis.set(i);
    for (int j = d - 1; j >= 0; j--)
      if (!vis[v[i][j]]) dfs(v[i][j], j + 1, 1, i);
  }
  for (int i = 1; i <= m; i++) {
    if (g1[e[i].x][e[i].y] ^ g2[e[i].x][e[i].y])
      puts("diff");
    else
      puts("same");
  }
  fclose(stdin);
  fclose(stdout);
  return 0;
}
