#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

const int N = 1'009;

vector<int> g[N];
bool was[N];
vector<int> order;

void dfs1(int x) {
  was[x] = true;
  for (int y : g[x]) {
    if (!was[y]) {
      dfs1(y);
    }
  }
  order.push_back(x);
}

vector<int> gt[N];

void dfs2(int x, int ncomp, int *comp) {
  comp[x] = ncomp;
  for (int y : gt[x]) {
    if (comp[y] == -1) {
      dfs2(y, ncomp, comp);
    }
  }
}

bool can[N][N];
int q[N];
int cnt[N];
int comp1[N];
int comp2[N];
int p[N];
bool lo[N];
bool hi[N];
int in[N];
int out[N];

const int M = 200'009;

int from[M];
int to[M];
bool ans[M];

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d %d", from + i, to + i);
    --from[i];
    --to[i];
  }
  for (int i = 0; i < n; ++i) {
    g[i].clear();
    gt[i].clear();
  }
  for (int i = 0; i < m; ++i) {
    g[from[i]].push_back(to[i]);
    gt[to[i]].push_back(from[i]);
  }
  memset(was, false, sizeof was);
  order.clear();
  for (int i = 0; i < n; ++i) {
    if (!was[i]) {
      dfs1(i);
    }
  }
  memset(comp1, -1, sizeof comp1);
  int ncomp1 = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (comp1[order[i]] == -1) {
      dfs2(order[i], ncomp1, comp1);
      ++ncomp1;
    }
  }
  for (int i = 0; i < n; ++i) {
    g[i].clear();
  }
  for (int i = 0; i < m; ++i) {
    if (comp1[from[i]] != comp1[to[i]]) {
      g[comp1[from[i]]].push_back(i);
    }
  }
  memset(can, false, sizeof can);
  for (int i = 0; i < ncomp1; ++i) {
    can[i][i] = true;
    q[0] = i;
    for (int qh = 0, qt = 1; qh < qt; ++qh) {
      int x = q[qh];
      for (int id : g[x]) {
        int y = comp1[to[id]];
        if (!can[i][y]) {
          can[i][y] = true;
          q[qt++] = y;
        }
      }
    }
  }
  memset(ans, false, sizeof ans);
  for (int x = 0; x < ncomp1; ++x) {
    memset(cnt, 0, sizeof cnt);
    for (int id : g[x]) {
      ++cnt[comp1[to[id]]];
    }
    for (int id : g[x]) {
      if (cnt[comp1[to[id]]] >= 2) {
        ans[id] = true;
      }
    }
    vector<int> w;
    for (int id : g[x]) {
      w.push_back(comp1[to[id]]);
    }
    sort(w.begin(), w.end());
    w.resize(distance(w.begin(), unique(w.begin(), w.end())));
    for (int id : g[x]) {
      int y = comp1[to[id]];
      for (int z : w) {
        if (z != y && can[z][y]) {
          ans[id] = true;
        }
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    memset(p, -1, sizeof p);
    int sz = 0;
    for (int j = 0; j < n; ++j) {
      if (j != i && comp1[j] == comp1[i]) {
        p[j] = sz++;
      }
    }
    for (int j = 0; j < n; ++j) {
      g[j].clear();
      gt[j].clear();
    }
    for (int j = 0; j < m; ++j) {
      if (p[from[j]] != -1 && p[to[j]] != -1) {
        g[p[from[j]]].push_back(p[to[j]]);
        gt[p[to[j]]].push_back(p[from[j]]);
      }
    }
    memset(was, false, sizeof was);
    order.clear();
    for (int j = 0; j < sz; ++j) {
      if (!was[j]) {
        dfs1(j);
      }
    }
    memset(comp2, -1, sizeof comp2);
    int ncomp2 = 0;
    for (int j = sz - 1; j >= 0; --j) {
      if (comp2[order[j]] == -1) {
        dfs2(order[j], ncomp2, comp2);
        ++ncomp2;
      }
    }
    for (int j = 0; j < n; ++j) {
      hi[j] = true;
      lo[j] = true;
    }
    for (int j = 0; j < m; ++j) {
      if (p[from[j]] != -1 && p[to[j]] != -1) {
        if (comp2[p[from[j]]] != comp2[p[to[j]]]) {
          lo[comp2[p[from[j]]]] = false;
          hi[comp2[p[to[j]]]] = false;
        }
      }
    }
    memset(in, 0, sizeof in);
    memset(out, 0, sizeof out);
    for (int j = 0; j < m; ++j) {
      if (from[j] == i && p[to[j]] != -1) {
        if (hi[comp2[p[to[j]]]]) {
          ++in[comp2[p[to[j]]]];
        }
      } else
      if (to[j] == i && p[from[j]] != -1) {
        if (lo[comp2[p[from[j]]]]) {
          ++out[comp2[p[from[j]]]];
        }
      }
    }
    for (int j = 0; j < m; ++j) {
      if (from[j] == i && p[to[j]] != -1) {
        if (hi[comp2[p[to[j]]]] && in[comp2[p[to[j]]]] == 1) {
          ans[j] = true;
        }
      } else
      if (to[j] == i && p[from[j]] != -1) {
        if (lo[comp2[p[from[j]]]] && out[comp2[p[from[j]]]] == 1) {
          ans[j] = true;
        }
      }
    }
  }
  for (int i = 0; i < m; ++i) {
    puts(ans[i] ? "diff" : "same");
  }
}


Measured memory_bytes: 7844