#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, M;
  scanf("%lld %lld", &N, &M);
  vector<int> edge[1001];
  int *A, *B;
  A = new int[M + 1];
  B = new int[M + 1];
  map<pair<int, int>, int> eind;
  for (int i = 1; i <= M; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    A[i] = a;
    B[i] = b;
    edge[a].push_back(b);
    eind[make_pair(a, b)] = i;
  }
  bool *conn;
  conn = new bool[M + 1];
  for (int i = 1; i <= M; i++) conn[i] = false;
  for (int v = 1; v <= N; v++) {
    bool chk[1001];
    for (int i = 1; i <= N; i++) chk[i] = false;
    chk[v] = true;
    stack<int> prev;
    for (int e = 0; e + 1 < edge[v].size(); e++) {
      prev.push(edge[v][e]);
      while (!prev.empty()) {
        int t = prev.top();
        prev.pop();
        chk[t] = true;
        for (int x : edge[t]) {
          if (!chk[x]) prev.push(x);
        }
      }
      if (chk[edge[v][e + 1]]) conn[eind[make_pair(v, edge[v][e + 1])]] = true;
    }
  }
  for (int v = 1; v <= N; v++) {
    bool chk[1001];
    for (int i = 1; i <= 1000; i++) chk[i] = false;
    chk[v] = true;
    stack<int> prev;
    for (int e = -1 + edge[v].size(); e > 0; e--) {
      prev.push(edge[v][e]);
      while (!prev.empty()) {
        int t = prev.top();
        prev.pop();
        chk[t] = true;
        for (int x : edge[t]) {
          if (!chk[x]) prev.push(x);
        }
      }
      if (chk[edge[v][e - 1]]) conn[eind[make_pair(v, edge[v][e - 1])]] = true;
    }
  }
  bitset<1001> map[1001];
  for (int i = 1; i <= N; i++) {
    map[i] = 0;
    map[i][i] = true;
  }
  for (int v = 1; v <= N; v++) {
    for (int e = 1; e <= M; e++) map[A[e]] |= map[B[e]];
  }
  for (int i = 1; i <= M; i++) {
    if (map[B[i]][A[i]] == conn[i])
      printf("same\n");
    else
      printf("diff\n");
  }
  delete[] A, B, conn;
  return 0;
}
