#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 50;
const int maxm = 200000 + 50;
int n, m;
int dfc;
int tim;
int top;
int scnt;
int f[maxn];
int cnt[maxn];
int deg[maxn];
int dfn[maxn];
int low[maxn];
int que[maxn];
int ran[maxn];
int sta[maxn];
int vis[maxn];
int head[maxn];
int sccno[maxn];
bool an[maxm];
vector<int> scc[maxn];
vector<pair<int, int> > adj[maxn];
struct edge {
  int to, nex;
  edge(int to = 0, int nex = 0) : to(to), nex(nex) {}
};
vector<edge> G;
inline void addedge(int u, int v) {
  G.push_back(edge(v, head[u])), head[u] = G.size() - 1;
}
inline void adde(int u, int v, int w) {
  adj[u].push_back(make_pair(v, w));
  ++deg[v];
}
void tarjan(int u) {
  low[u] = dfn[u] = ++dfc;
  sta[++top] = u;
  for (int i = head[u]; ~i; i = G[i].nex) {
    int v = G[i].to;
    if (!dfn[v]) {
      tarjan(v);
      low[u] = min(low[u], low[v]);
    } else if (!sccno[v]) {
      low[u] = min(low[u], dfn[v]);
    }
  }
  if (low[u] >= dfn[u]) {
    ++scnt;
    while (true) {
      int v = sta[top--];
      sccno[v] = scnt;
      scc[scnt].push_back(v);
      if (u == v) break;
    }
  }
}
void findscc() {
  for (int i = 1; i <= n; ++i)
    if (!dfn[i]) {
      tarjan(i);
    }
  for (int u = 1; u <= n; ++u) {
    for (int i = head[u]; ~i; i = G[i].nex) {
      int v = G[i].to;
      if (sccno[u] != sccno[v]) {
        adde(sccno[u], sccno[v], i);
      }
    }
  }
}
void topsort() {
  int hd = 0, tl = 0;
  for (int i = 1; i <= scnt; ++i)
    if (deg[i] == 0) {
      que[tl++] = i;
    }
  while (hd < tl) {
    int u = que[hd++];
    for (unsigned int i = 0; i < adj[u].size(); ++i) {
      int v = G[i].to;
      if (--deg[v] == 0) {
        que[tl++] = v;
      }
    }
  }
  for (int i = 0; i < n; ++i) ran[que[i]] = i;
}
void solve1(int x) {
  memset(f, 0, sizeof(f));
  f[x] = 1;
  for (int j = ran[x]; j < n; ++j) {
    int u = que[j];
    for (unsigned int i = 0; i < adj[u].size(); ++i) {
      int v = adj[u][i].first;
      f[v] = min(2, f[u] + f[v]);
    }
  }
  for (unsigned int i = 0; i < adj[x].size(); ++i) {
    int v = adj[x][i].first;
    if (f[v] > 1) an[adj[x][i].second] = true;
  }
}
void dfs(int u) {
  if (vis[u] == tim || cnt[u] == 2) return;
  vis[u] = tim;
  ++cnt[u];
  for (int i = head[u]; ~i; i = G[i].nex) {
    int v = G[i].to;
    if (sccno[v] == sccno[u]) {
      dfs(v);
    }
  }
}
void solve2(int x) {
  for (unsigned int j = 0; j < scc[x].size(); ++j) {
    int u = scc[x][j];
    memset(cnt, 0, sizeof(cnt));
    for (int i = head[u]; ~i; i = G[i].nex) {
      int v = G[i].to;
      if (sccno[v] == x) {
        vis[u] = ++tim;
        dfs(v);
      }
    }
    for (int i = head[u]; ~i; i = G[i].nex) {
      int v = G[i].to;
      if (sccno[v] == x) {
        if (cnt[v] == 1) an[i] = true;
      }
    }
  }
}
void solve() {
  findscc();
  topsort();
  for (int i = 1; i <= scnt; ++i) {
    solve1(i);
    solve2(i);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  memset(head, -1, sizeof(head));
  for (int i = 1; i <= m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    addedge(a, b);
  }
  solve();
  for (int i = 0; i < m; ++i) {
    puts(an[i] ? "diff" : "same");
  }
  return 0;
}
