#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e3 + 3;
vector<pair<int, int> > V[N], U[N];
vector<int> Y[N];
int D[N], low[N], zaman, H[N], Scc[N], scc, T[N], ans[N], n, m, x, y, i, X;
stack<int> S;
void f(int x) {
  D[x] = low[x] = ++zaman;
  S.push(x);
  H[x] = 1;
  for (auto t : V[x]) {
    int y = t.first;
    if (y == X) continue;
    if (!D[y]) {
      f(y);
      low[x] = min(low[x], low[y]);
    } else if (H[y])
      low[x] = min(low[x], D[y]);
  }
  if (low[x] == D[x]) {
    scc++;
    for (int y = 0; y != x;) {
      y = S.top();
      S.pop();
      H[y] = 0;
      Scc[y] = scc;
      Y[scc].push_back(y);
    }
  }
}
void g(int x) {
  X = x;
  int i;
  memset(D, zaman = 0, sizeof D);
  memset(Scc, scc = 0, sizeof Scc);
  for (i = 1; i <= n; i++) {
    Y[i].clear();
    U[i].clear();
  }
  for (i = 1; i <= n; i++)
    if (i != X && !D[i]) f(i);
  if (x == 0) {
    for (i = 1; i <= n; i++) T[i] = Scc[i];
    return;
  }
  memset(D, 0, sizeof D);
  for (auto t : V[X]) {
    U[Scc[t.first]].push_back(t);
  }
  for (i = scc; i; i--) {
    if (!D[i] && U[i].size() == 0) continue;
    if (D[i] || U[i].size() > 1) {
      for (auto t : U[i]) {
        ans[t.second] = T[X] == T[t.first];
      }
    } else {
      for (auto t : U[i]) ans[t.second] = T[X] != T[t.first];
    }
    for (auto x : Y[i]) {
      for (auto y : V[x]) D[Scc[y.first]] = 1;
    }
  }
}
signed main() {
  cin >> n >> m;
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    V[x].push_back(make_pair(y, i));
  }
  for (i = 0; i <= n; i++) g(i);
  for (i = 1; i <= m; i++) puts(ans[i] ? "same" : "diff");
  return 0;
}
