#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  return (b < a) ? (a = b, 1) : 0;
}
using ll = long long;
using R = long double;
const R EPS = 1e-9L;
inline int sgn(const R &r) { return (r > EPS) - (r < -EPS); }
inline R sq(R x) { return sqrt(max(x, 0.0L)); }
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const pid_t pid = getpid();
const int limit = 1010;
vector<int> graph[limit];
bool visited[limit][limit];
int cnt[limit][limit];
int a[200010], b[200010];
void dfs(int v, int root) {
  visited[root][v] = true;
  for (auto &v2 : graph[v]) {
    if (visited[root][v2]) continue;
    dfs(v2, root);
  }
}
int ord[limit][limit];
int low[limit][limit];
int scc[limit][limit];
stack<int> stk;
void scc_dfs(int v, int &k, int ban) {
  ord[ban][v] = k++;
  low[ban][v] = ord[ban][v];
  stk.push(v);
  for (auto &v2 : graph[v]) {
    if (v2 == ban or scc[ban][v2] != -1) continue;
    if (ord[ban][v2] == -1)
      scc_dfs(v2, k, ban), chmin(low[ban][v], low[ban][v2]);
    else
      chmin(low[ban][v], ord[ban][v2]);
  }
  if (ord[ban][v] != low[ban][v]) return;
  while (1) {
    int u = stk.top();
    stk.pop();
    scc[ban][u] = v;
    if (u == v) break;
  }
}
vector<int> tmp;
void ord_dfs(int v, int ban) {
  ord[ban][v] = 0;
  for (auto &v2 : graph[v]) {
    if (v2 == ban or ord[ban][v2] != -1) continue;
    ord_dfs(v2, ban);
  }
  tmp.push_back(v);
}
void scc_calc(int n, int ban) {
  int k = 0;
  for (int v = int(0); v < int(n); ++v)
    ord[ban][v] = low[ban][v] = scc[ban][v] = -1;
  for (int v = int(0); v < int(n); ++v) {
    if (v == ban or ord[ban][v] != -1) continue;
    scc_dfs(v, k, ban);
  }
  for (int v = int(0); v < int(n); ++v) ord[ban][v] = -1;
  tmp.clear();
  for (int v = int(0); v < int(n); ++v) {
    if (v == ban or ord[ban][v] != -1) continue;
    ord_dfs(v, ban);
  }
  reverse(begin(tmp), end(tmp));
  for (int i = int(0); i < int(tmp.size()); ++i) ord[ban][tmp[i]] = i;
}
int main(void) {
  int n, m;
  cin >> n >> m;
  for (int i = int(0); i < int(m); ++i) {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
    graph[a[i]].push_back(b[i]);
    cnt[a[i]][b[i]]++;
  }
  for (int i = int(0); i < int(n); ++i) dfs(i, i);
  for (int i = int(0); i < int(n); ++i) scc_calc(n, i);
  for (int i = int(0); i < int(m); ++i) {
    bool ab = (cnt[a[i]][b[i]] >= 2);
    for (int j = int(0); j < int(n); ++j) {
      if (j == a[i]) continue;
      if (cnt[j][b[i]] == 0) continue;
      if (visited[a[i]][j] == false) continue;
      const int aord = ord[b[i]][scc[b[i]][a[i]]];
      const int jord = ord[b[i]][scc[b[i]][j]];
      if (aord <= jord) ab = true;
    }
    bool ba = visited[b[i]][a[i]];
    if (ab != ba)
      puts("diff");
    else
      puts("same");
  }
  return 0;
}
