#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long s[100010], e[100010];
long long ih[1111][1111];
long long chk[1111];
vector<long long> v[1111], back[1111];
queue<long long> Q;
long long chk1[1111], chk2[1111];
long long ord[1111], ordtop;
long long scc[1111], scccolor;
void dfs1(long long x) {
  long long i;
  for (i = 0; i < v[x].size(); i++) {
    if (!chk1[v[x][i]]) {
      chk1[v[x][i]] = 1;
      dfs1(v[x][i]);
    }
  }
  ordtop++;
  ord[ordtop] = x;
}
void dfs2(long long x) {
  scc[x] = scccolor;
  long long i;
  for (i = 0; i < back[x].size(); i++) {
    if (!chk2[back[x][i]]) {
      chk2[back[x][i]] = 1;
      dfs2(back[x][i]);
    }
  }
}
int main() {
  scanf("%lld %lld", &n, &m);
  long long i, j;
  for (i = 1; i <= m; i++) {
    scanf("%lld %lld", &s[i], &e[i]);
    v[s[i]].push_back(e[i]);
    back[e[i]].push_back(s[i]);
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) chk[j] = 0;
    chk[i] = -1;
    for (j = 0; j < v[i].size(); j++) {
      chk[v[i][j]] = v[i][j];
      Q.push(v[i][j]);
    }
    while (!Q.empty()) {
      long long x = Q.front();
      Q.pop();
      for (j = 0; j < v[x].size(); j++) {
        if (chk[x] == -1) {
          if (chk[v[x][j]]) {
            ih[i][v[x][j]] = 1;
          } else {
            chk[v[x][j]] = -1;
            Q.push(v[x][j]);
          }
        } else {
          if (chk[v[x][j]]) {
            if (chk[v[x][j]] != chk[x] && chk[v[x][j]] != -1) {
              ih[i][v[x][j]] = 1;
              chk[v[x][j]] = -1;
              Q.push(v[x][j]);
            }
          } else {
            chk[v[x][j]] = chk[x];
            Q.push(v[x][j]);
          }
        }
      }
    }
  }
  for (i = 1; i <= n; i++) {
    if (!chk1[i]) {
      chk1[i] = 1;
      dfs1(i);
    }
  }
  for (i = n; i >= 1; i--) {
    if (!chk2[ord[i]]) {
      scccolor++;
      chk2[ord[i]] = 1;
      dfs2(ord[i]);
    }
  }
  for (i = 1; i <= m; i++) {
    printf(ih[s[i]][e[i]] ^ (scc[s[i]] == scc[e[i]]) ? "diff" : "same");
    puts("");
  }
}
