#include <bits/stdc++.h>
using namespace std;
const int N = 1010, M = 2e5 + 10;
int w[M], ne[M], la[N], t, ans[M];
void link(int x, int y) {
  w[++t] = y;
  ne[t] = la[x];
  la[x] = t;
}
int arv[N][N], n, m, X, mrk[N], ti, mrk2[N];
void dfs(int x) {
  arv[X][x] = 1;
  for (int y = la[x]; y; y = ne[y])
    if (!arv[X][w[y]]) dfs(w[y]);
}
void go(int x) {
  mrk[x] = ti;
  for (int y = la[x]; y; y = ne[y])
    if (w[y] != X && !mrk[w[y]]) go(w[y]);
}
void go2(int x) {
  mrk2[x] = ti;
  for (int y = la[x]; y; y = ne[y])
    if (w[y] != X && !mrk2[w[y]]) go2(w[y]);
}
vector<int> c;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    link(x, y);
  }
  for (X = 1; X <= n; X++) dfs(X);
  for (X = 1; X <= n; X++) {
    for (int i = 1; i <= n; i++) mrk[i] = mrk2[i] = 0;
    c.clear();
    for (int y = la[X]; y; y = ne[y]) {
      ti++;
      if (!mrk[y]) go(w[y]);
      c.push_back(w[y]);
    }
    while (c.size()) {
      if (!mrk2[c.back()]) go2(c.back());
      c.pop_back();
      ti--;
    }
    for (int y = la[X]; y; y = ne[y])
      ans[y] = (mrk[w[y]] < mrk2[w[y]]) == arv[w[y]][X];
  }
  for (int i = 1; i <= m; i++) puts(ans[i] ? "same" : "diff");
}
