#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 dag_edge[1010][1010];
bitset<1010> dag_visit[1010], dag_second_visit[1010];
int topo_sort[1010], topo_cnt;
int n;
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);
    }
  }
}
void topological_sort(int f) {
  if (starred[f]) return;
  starred[f] = true;
  for (int u : ll[f]) {
    topological_sort(unf[u]);
  }
  topo_sort[topo_cnt++] = f;
}
int main() {
  int 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]) {
      topo_sort[topo_cnt++] = u;
      kosaraju2(u, u);
    }
  }
  for (i = 1; i <= n; ++i) {
    get_star_list(i);
  }
  for (auto u : piv) {
    ++dag_edge[unf[u.first]][unf[u.second]];
  }
  for (i = 0; i < topo_cnt / 2; ++i) {
    swap(topo_sort[i], topo_sort[topo_cnt - 1 - i]);
  }
  for (i = topo_cnt - 1; i >= 0; --i) {
    int f = topo_sort[i];
    for (int j = i + 1; j < topo_cnt; ++j) {
      int f2 = topo_sort[j];
      if (dag_edge[f][f2]) {
        bitset<1010> u;
        u.set(f2);
        dag_visit[f] |= dag_visit[f2] | u;
      }
    }
  }
  for (i = 0; i < topo_cnt; ++i) {
    int f = topo_sort[i];
    for (int j = i + 1; j < topo_cnt; ++j) {
      int f2 = topo_sort[j];
      if (dag_visit[f].test(f2)) {
        dag_second_visit[f] |= dag_visit[f2];
      }
    }
  }
  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(dag_edge[unf[u.first]][unf[u.second]] >= 2 ||
                   dag_second_visit[unf[u.first]].test(unf[u.second])
               ? "diff"
               : "same");
    }
  }
  return 0;
}
