#include <bits/stdc++.h>
using namespace std;
const int N = 1010, M = 200010;
int n, m;
namespace G {
int h1[N], h2[N], tot;
int g1sum[N][N], g2sum[N][N];
struct Edge {
  int v, next;
} e[M * 2];
int oriCnt, oriEdge[M][2];
void addEdge(int u, int v, int *h = h1) {
  e[++tot] = (Edge){v, h[u]};
  h[u] = tot;
  if (h == h1) {
    oriCnt++;
    oriEdge[oriCnt][0] = u;
    oriEdge[oriCnt][1] = v;
    g1sum[u][v]++;
  } else
    g2sum[u][v]++;
}
int dfn[N], low[N], dfnTimer;
int bcnt, bel[N];
void TarjanDfs(int u) {
  static int sta[N], top = 0;
  static bool inStack[N];
  dfn[u] = low[u] = ++dfnTimer;
  sta[++top] = u;
  inStack[u] = true;
  for (int i = h1[u], v; i; i = e[i].next) {
    v = e[i].v;
    if (!dfn[v]) {
      TarjanDfs(v);
      low[u] = min(low[u], low[v]);
    } else if (inStack[v])
      low[u] = min(low[u], dfn[v]);
  }
  if (dfn[u] == low[u]) {
    bcnt++;
    int x;
    do {
      x = sta[top--];
      inStack[x] = false;
      bel[x] = bcnt;
    } while (x != u);
  }
}
void Tarjan() {
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) TarjanDfs(i);
}
void buildGraph() {
  for (int i = 1; i <= oriCnt; i++) {
    int u = oriEdge[i][0], v = oriEdge[i][1];
    if (bel[u] != bel[v]) addEdge(bel[u], bel[v], h2);
  }
}
int recMin[N][N], recMax[N][N];
void dfs(int u, int rt, int st, int *arr) {
  if (arr[u]) return;
  arr[u] = st;
  for (int i = h1[u], v; i; i = e[i].next)
    if ((v = e[i].v) != rt) dfs(v, rt, st, arr);
}
void calc() {
  for (int u = 1; u <= n; u++) {
    for (int v = 1; v <= n; v++)
      if (g1sum[u][v]) dfs(v, u, v, recMin[u]);
    for (int v = n; v >= 1; v--)
      if (g1sum[u][v]) dfs(v, u, v, recMax[u]);
  }
}
bool existAnother(int u, int v) {
  return recMin[u][v] != v || recMax[u][v] != v;
}
bool judgeEdge(int u, int v) {
  if (bel[u] == bel[v]) {
    if (g1sum[u][v] > 1) return false;
    return !existAnother(u, v);
  } else {
    if (g1sum[u][v] > 1 || g2sum[bel[u]][bel[v]] > 1) return true;
    return existAnother(u, v);
  }
}
}  // namespace G
void readData() {
  scanf("%d%d", &n, &m);
  int u, v;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    G::addEdge(u, v);
  }
}
void solve() {
  for (int i = 1; i <= m; i++) {
    int u = G::oriEdge[i][0], v = G::oriEdge[i][1];
    puts(G::judgeEdge(u, v) ? "diff" : "same");
  }
}
int main() {
  readData();
  G::Tarjan();
  G::buildGraph();
  G::calc();
  solve();
  return 0;
}
