#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5, M = 2e5 + 5;
int n, m, U[N], V[N], id, f[N], dfn[N], low[N];
vector<int> e[N];
stack<int> s;
bool vis[N];
int mp[N][N];
int vis1[N], vis2[N];
void dfs(int u) {
  dfn[u] = low[u] = ++id;
  s.push(u);
  vis[u] = true;
  for (int i = 0; i < e[u].size(); i++) {
    int v = e[u][i];
    if (!dfn[v])
      dfs(v), low[u] = min(low[u], low[v]);
    else if (vis[v])
      low[u] = min(low[u], dfn[v]);
  }
  if (low[u] == dfn[u]) {
    while (s.top() != u) vis[s.top()] = false, f[s.top()] = u, s.pop();
    f[u] = u;
    s.pop();
    vis[u] = false;
  }
}
void dfs1(int u, int k) {
  if (vis1[u]) return;
  vis1[u] = k;
  for (int i = 0; i < e[u].size(); i++) {
    int v = e[u][i];
    if (vis1[v]) continue;
    dfs1(v, k);
  }
}
void dfs2(int u, int k) {
  if (vis2[u]) return;
  vis2[u] = k;
  for (int i = 0; i < e[u].size(); i++) {
    int v = e[u][i];
    if (vis2[v]) continue;
    dfs2(v, k);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &U[i], &V[i]);
    e[U[i]].push_back(V[i]);
  }
  dfs(1);
  for (int i = 1; i <= m; i++) {
    if (f[U[i]] == f[V[i]]) {
      if (mp[U[i]][V[i]] == 2)
        printf("same\n");
      else
        printf("diff\n");
    } else {
      if (mp[U[i]][V[i]] == 1)
        printf("same\n");
      else
        printf("diff\n");
    }
  }
}
