#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n, m;
vector<int> e[N], id[N], _e[N], _id[N];
int p[2][N];
bool w[N];
bool ans[20010];
void dfs(int u, int id, int o) {
  p[o][u] = id;
  for (int i = 0; i < e[u].size(); ++i)
    if (!p[o][e[u][i]]) dfs(e[u][i], id, o);
}
void dfs2(int u) {
  w[u] = 1;
  for (int i = 0; i < e[u].size(); ++i)
    if (!w[e[u][i]]) dfs2(e[u][i]);
}
int main() {
  int i, j, x, y;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    e[x].push_back(y);
    id[x].push_back(i);
    _e[y].push_back(x);
    _id[y].push_back(i);
  }
  for (i = 1; i <= n; ++i) {
    memset(p, 0, sizeof p);
    p[0][i] = p[1][i] = n + 1;
    for (j = 0; j < e[i].size(); ++j)
      if (!p[0][e[i][j]]) dfs(e[i][j], id[i][j], 0);
    for (j = e[i].size() - 1u; ~j; --j)
      if (!p[1][e[i][j]]) dfs(e[i][j], id[i][j], 1);
    for (j = 0; j < e[i].size(); ++j)
      if (p[0][e[i][j]] != id[i][j] || p[1][e[i][j]] != id[i][j])
        ans[id[i][j]] ^= 1;
  }
  for (i = 1; i <= n; ++i) {
    memset(w, 0, sizeof w);
    dfs2(i);
    for (j = 0; j < _e[i].size(); ++j)
      if (w[_e[i][j]]) ans[_id[i][j]] ^= 1;
  }
  for (i = 1; i <= m; ++i)
    if (ans[i])
      puts("diff");
    else
      puts("same");
  return 0;
}
