#include <bits/stdc++.h>
using namespace std;
long long read() {
  char ch = getchar();
  long long x = 0;
  int op = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') op = -1;
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 1) + ch - '0';
  return x * op;
}
int n, m, a[1005][1005], x[200005], y[200005], z[200005], vis[1005],
    p[1005][1005], q[1005][1005];
vector<int> e[1005];
void dfs(int st, int u) {
  vis[u] = 1;
  a[st][u] = 1;
  for (int i = (0); i <= ((int)e[u].size() - 1); i++) {
    int v = e[u][i];
    if (!vis[v]) dfs(st, v);
  }
}
void dfs1(int st, int u, int id) {
  vis[u] = 1;
  p[st][u] = min(id, p[st][u]);
  for (int i = (0); i <= ((int)e[u].size() - 1); i++) {
    int v = e[u][i];
    if (!vis[v]) dfs1(st, v, id);
  }
}
void dfs2(int st, int u, int id) {
  vis[u] = 1;
  q[st][u] = max(id, q[st][u]);
  for (int i = (0); i <= ((int)e[u].size() - 1); i++) {
    int v = e[u][i];
    if (!vis[v]) dfs2(st, v, id);
  }
}
int main() {
  n = read();
  m = read();
  for (int i = (1); i <= (m); i++) {
    x[i] = read(), y[i] = read();
    z[i] = (int)e[x[i]].size();
    e[x[i]].push_back(y[i]);
  }
  for (int i = (1); i <= (n); i++) {
    memset(vis, 0, sizeof(vis));
    dfs(i, i);
  }
  memset(p, 0x3f, sizeof(p));
  memset(q, 0xc0, sizeof(q));
  for (int i = (1); i <= (n); i++) {
    memset(vis, 0, sizeof(vis));
    vis[i] = 1;
    for (int j = (0); j <= ((int)e[i].size() - 1); j++)
      if (!vis[e[i][j]]) dfs1(i, e[i][j], j);
    memset(vis, 0, sizeof(vis));
    vis[i] = 1;
    for (int j = ((int)e[i].size() - 1); j >= (0); j--)
      if (!vis[e[i][j]]) dfs2(i, e[i][j], j);
  }
  for (int i = (1); i <= (m); i++) {
    bool f1 = a[y[i]][x[i]];
    bool f2 = p[x[i]][y[i]] != z[i] || q[x[i]][y[i]] != z[i];
    if (f1 == f2)
      puts("same");
    else
      puts("diff");
  }
  return 0;
}
