#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> E[1010];
int M;
int ID[1010][1010];
int G[1010][1010];
int P[1010][1010];
int D[2][1010];
int A[202020], B[202020];
void dfs(int cur, int org) {
  if (G[org][cur]) return;
  G[org][cur] = 1;
  for (auto& e : E[cur]) dfs(e, org);
}
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N >> M;
  memset(ID, 0xff, sizeof(ID));
  for (i = 0; i < (M); i++) {
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
    E[A[i]].push_back(B[i]);
    ID[A[i]][B[i]] = i;
  }
  for (i = 0; i < (N); i++) dfs(i, i);
  for (i = 0; i < (N); i++) {
    for (j = 0; j < (2); j++) {
      for (x = 0; x < (N); x++) D[j][x] = -1 << 30;
      priority_queue<pair<int, int>> PQ;
      for (x = 0; x < (N); x++)
        if (ID[i][x] >= 0) {
          D[j][x] = ID[i][x];
          if (j) D[j][x] = -D[j][x];
          PQ.push({D[j][x], x});
        }
      while (PQ.size()) {
        int cur = PQ.top().second;
        int sc = PQ.top().first;
        PQ.pop();
        if (D[j][cur] != sc) continue;
        for (auto& e : E[cur])
          if (D[j][e] < sc) {
            D[j][e] = sc;
            PQ.push({sc, e});
          }
      }
    }
    for (x = 0; x < (N); x++) {
      if (D[0][x] == -1 << 30)
        P[i][x] = 0;
      else if (D[0][x] == -D[1][x])
        P[i][x] = 1;
      else
        P[i][x] = 2;
    }
  }
  for (i = 0; i < (M); i++) {
    x = P[A[i]][B[i]] == 2;
    y = G[B[i]][A[i]];
    if (x == y)
      cout << "same" << endl;
    else
      cout << "diff" << endl;
  }
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}
