#include <bits/stdc++.h>
bool can[1111][1111], exc[1111][1111];
inline bool ask(int x, int y) { return can[y][x] ^ exc[x][y]; }
int x[111111], y[111111], n, m;
std::vector<int> v[1111];
bool vis[1111];
inline void dfs(int s, int p) {
  if (vis[p]) return;
  vis[p] = can[s][p] = 1;
  for (register int i = 0; i < v[p].size(); i++) dfs(s, v[p][i]);
}
int frm[1111];
inline void efs(int fs, int s, int p) {
  if (vis[p]) return;
  vis[p] = 1;
  if (frm[p])
    if (frm[p] ^ s) exc[fs][p] = 1;
  frm[p] = s;
  for (register int i = 0; i < v[p].size(); i++) efs(fs, s, v[p][i]);
}
int main() {
  scanf("%d%d", &n, &m);
  register int i, ii;
  for (i = 1; i <= m; i++) scanf("%d%d", &x[i], &y[i]), v[x[i]].push_back(y[i]);
  for (i = 1; i <= n; i++) {
    for (ii = 1; ii <= n; ii++) vis[ii] = 0;
    dfs(i, i);
  }
  for (i = 1; i <= n; i++) {
    for (ii = 1; ii <= n; ii++) vis[ii] = frm[ii] = 0;
    vis[i] = 1;
    for (ii = 0; ii < v[i].size(); ii++) efs(i, v[i][ii], v[i][ii]);
    for (ii = 1; ii <= n; ii++) vis[ii] = 0;
    for (ii = v[i].size() - 1; ~ii; ii--) efs(i, v[i][ii], v[i][ii]);
  }
  for (i = 1; i <= m; i++) puts(ask(x[i], y[i]) ? "diff" : "same");
}
