#include <bits/stdc++.h>
using namespace std;
int res[1010][1010];
vector<int> ll[1010], bll[1010];
bool starred[1010];
int cnt[1010];
int unf[1010];
vector<int> kos;
vector<pair<int, int> > piv;
int find_stars(int, int);
void get_star_list(int removed) {
  memset(starred, 0, 1010 * sizeof(bool));
  for (int u : bll[removed]) {
    if (unf[u] == unf[removed]) {
      starred[u] = true;
    }
  }
  for (int u : bll[removed]) {
    if (starred[u]) {
      find_stars(removed, u);
    }
  }
}
int find_stars(int removed, int s) {
  int r = -1;
  if (res[removed][s]) return res[removed][s];
  if (cnt[s] >= 2) return -1;
  ++cnt[s];
  for (int u : ll[s]) {
    if (u == removed || unf[u] != unf[removed]) continue;
    int temp = find_stars(removed, u);
    if (starred[u]) temp = temp == -1 || temp == u ? u : -2;
    if (temp == -2)
      r = -2;
    else if (temp != -1)
      r = r == -1 || r == temp ? temp : -2;
  }
  --cnt[s];
  return res[removed][s] = r;
}
void kosaraju(int f) {
  for (int u : ll[f]) {
    if (!starred[u]) {
      starred[u] = true;
      kosaraju(u);
    }
  }
  kos.push_back(f);
}
void kosaraju2(int f, int f2) {
  unf[f] = f2;
  for (int u : ll[f]) {
    if (!unf[u]) {
      kosaraju2(u, f2);
    }
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int i;
  for (i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    ll[a].push_back(b);
    piv.emplace_back(a, b);
    bll[b].push_back(a);
  }
  for (i = 1; i <= n; ++i) {
    if (!starred[i]) {
      starred[i] = true;
      kosaraju(i);
    }
  }
  for (int u : kos) {
    if (!unf[u]) {
      kosaraju2(u, u);
    }
  }
  for (i = 1; i <= n; ++i) {
    get_star_list(i);
  }
  for (auto u : piv) {
    if (unf[u.first] == unf[u.second]) {
      int t = find_stars(u.second, u.first);
      puts(t == -1 || t == u.first ? "diff" : "same");
    } else
      puts("diff");
  }
  return 0;
}
