#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n, m, ind, cnt, top;
int vis[N], que[N], stk[N], bl[N], dfn[N], low[N], u[N * 200], v[N * 200];
bool ok[N], ins[N];
vector<int> ve[N], id[N];
inline void tarjan(int x) {
  stk[++top] = x;
  ins[x] = 1;
  dfn[x] = low[x] = ++ind;
  for (auto to : ve[x])
    if (!dfn[to])
      tarjan(to), low[x] = min(low[x], low[to]);
    else if (ins[to])
      low[x] = min(low[x], dfn[to]);
  if (low[x] == dfn[x]) {
    int y;
    ++cnt;
    do y = stk[top--], ins[y] = 0, bl[y] = cnt;
    while (y != x);
  }
}
inline void solve(int rt) {
  int head = 1, tail = 0;
  vis[rt] = ++ind;
  for (int i = 0; i < ve[rt].size(); ++i) {
    ok[id[rt][i]] |= vis[ve[rt][i]] == ind;
    if (vis[ve[rt][i]] != ind) vis[ve[rt][i]] = ind, que[++tail] = ve[rt][i];
    while (head <= tail) {
      int x = que[head++];
      for (auto to : ve[x])
        if (vis[to] != ind) vis[to] = ind, que[++tail] = to;
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, a, b; i <= m; ++i)
    scanf("%d%d", &a, &b), ve[a].push_back(b), id[a].push_back(i), u[i] = a,
                                                                   v[i] = b;
  tarjan(1);
  for (int i = 1; i <= n; ++i)
    solve(i), reverse(ve[i].begin(), ve[i].end()),
        reverse(id[i].begin(), id[i].end()), solve(i);
  for (int i = 1; i <= m; ++i) {
    if (bl[u[i]] == bl[v[i]])
      puts(ok[i] ? "same" : "diff");
    else
      puts(ok[i] ? "diff" : "same");
  }
  return 0;
}
