#include <bits/stdc++.h>
using namespace std;
static const int MAX_N = 1000;
int N, M;
int a[MAX_N], b[MAX_N];
bool G[MAX_N][MAX_N];
bool visited[MAX_N];
bool bfs(int s, int t) {
  visited[s] = true;
  queue<int> qa;
  qa.push(s);
  while (!qa.empty()) {
    int u = qa.front();
    qa.pop();
    for (int v = 0; v < N; v++) {
      if (G[u][v] && !visited[v]) {
        qa.push(v);
        visited[v] = true;
      }
    }
  }
  return visited[t];
}
int main() {
  cin >> N >> M;
  fill(G[0], G[N], false);
  for (int i = 0; i < M; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    G[a[i]][b[i]] = true;
  }
  for (int i = 0; i < M; i++) {
    fill(visited, visited + N, false);
    bool def1 = bfs(b[i], a[i]);
    fill(visited, visited + N, false);
    G[a[i]][b[i]] = false;
    bool def2 = bfs(a[i], b[i]);
    G[a[i]][b[i]] = true;
    if (!(def1 ^ def2))
      cout << "same" << endl;
    else
      cout << "diff" << endl;
  }
  return 0;
}
