#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
const int M = 2e5 + 10;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
int n, m, fr[M], to[M], nxt[M], tt, s, t, id[N], h[N];
bool vis[N][N], can[M];
void adde(int u, int v) { fr[++tt] = u, to[tt] = v, nxt[tt] = h[u], h[u] = tt; }
void dfs(int u) {
  vis[s][u] = 1;
  if (id[u]) return;
  id[u] = t;
  for (int i = h[u], v; v = to[i], i; i = nxt[i])
    if (!id[v] && v != s) dfs(v);
}
int main() {
  cin >> n >> m;
  for (int i = 1, u, v; i <= m; i++) u = gi(), v = gi(), adde(u, v);
  for (s = 1; s <= n; s++) {
    memset(id, 0, sizeof(id));
    vector<int> son;
    for (int i = h[s], v; v = to[i], i; i = nxt[i])
      son.push_back(v), dfs(t = v);
    reverse(son.begin(), son.end());
    for (int i = h[s], v; v = to[i], i; i = nxt[i])
      if (id[v] != v) can[i] = 1;
    memset(id, 0, sizeof(id));
    for (auto v : son) dfs(t = v);
    for (int i = h[s], v; v = to[i], i; i = nxt[i])
      if (id[v] != v) can[i] = 1;
  }
  for (int i = 1; i <= m; i++) {
    int u = fr[i], v = to[i];
    if ((can[i]) == (vis[v][u]))
      cout << "same\n";
    else
      cout << "diff\n";
  }
  return 0;
}
