#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int n, m, u[200010], v[200010], chk[maxn];
bool vis[maxn][maxn], ok[maxn][maxn];
vector<int> G[maxn];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &u[i], &v[i]);
    G[u[i]].push_back(v[i]);
  }
  for (int i = 1; i <= n; i++) {
    memset(chk, 0, sizeof(chk));
    queue<int> q;
    for (int j : G[i]) {
      q.push(j), chk[j] = j;
    }
    while (!q.empty()) {
      int v = q.front();
      q.pop();
      vis[i][v] = 1;
      for (int u : G[v])
        if (!chk[u] || chk[u] == u) {
          if (chk[u] == chk[v]) continue;
          chk[u] = chk[v], q.push(u);
        }
    }
    for (int j : G[i]) {
      if (chk[j] ^ j) ok[i][j] = 1;
    }
  }
  for (int i = 1; i <= m; i++) {
    printf("%s\n", ok[u[i]][v[i]] == vis[v[i]][u[i]] ? "same" : "diff");
  }
  return 0;
}
