#include <bits/stdc++.h>
using namespace std;
void bfs(int num, vector<vector<int> > &chi, vector<int> &order,
         vector<bool> &seen, int &nex_num) {
  if (!seen[num]) {
    seen[num] = true;
    for (int i = 0; i < chi[num].size(); i++) {
      bfs(chi[num][i], chi, order, seen, nex_num);
    }
    order[nex_num] = num;
    nex_num++;
  }
}
void bfsx(int num, int lab, vector<vector<int> > &chi, vector<bool> &seen,
          vector<int> &cone) {
  if (!seen[num]) {
    seen[num] = true;
    cone[num] = lab;
    for (int i = 0; i < chi[num].size(); i++) {
      bfsx(chi[num][i], lab, chi, seen, cone);
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> st(m);
  vector<int> to(m);
  vector<int> cone(n, -1);
  vector<vector<int> > chi(n);
  vector<vector<int> > pa(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    st[i] = a;
    to[i] = b;
    chi[a].push_back(b);
    pa[b].push_back(a);
  }
  vector<int> order(n, -1);
  int nex_num = 0;
  vector<bool> seen(n, false);
  for (int i = 0; i < n; i++) {
    bfs(i, chi, order, seen, nex_num);
  }
  seen = vector<bool>(n, false);
  for (int i = n - 1; i >= 0; i--) {
    bfsx(order[i], order[i], pa, seen, cone);
  }
  vector<vector<int> > can_move(n, vector<int>(n, -2));
  for (int i = 0; i < n; i++) {
    queue<int> q;
    for (int j = 0; j < chi[i].size(); j++) {
      can_move[i][chi[i][j]] = chi[i][j];
      q.push(chi[i][j]);
    }
    while (!q.empty()) {
      int st1 = q.front();
      q.pop();
      int col = can_move[i][st1];
      for (int j = 0; j < chi[st1].size(); j++) {
        int to1 = chi[st1][j];
        if (can_move[i][to1] != col and can_move[i][to1] != -1 and to1 != i) {
          if (can_move[i][to1] == -2) {
            can_move[i][to1] = col;
          } else {
            can_move[i][to1] = -1;
          }
          q.push(to1);
        }
      }
    }
  }
  for (int i = 0; i < m; i++) {
    if (can_move[st[i]][to[i]] == to[i]) {
      cout << "diff" << endl;
    } else {
      cout << "same" << endl;
    }
  }
}
