#include <bits/stdc++.h>
using namespace std;
int N, M;
vector<int> G[1010], R[1010], T[1010], id[1010];
int ord[1010];
bool vis[1010];
int mem[1010];
int cnt, cnt1, cnt2;
vector<int> V;
int A[200010], B[200010];
bool can[200010];
int now = 0;
void unit(int v) {
  if (vis[v]) return;
  vis[v] = true;
  mem[v] = 1;
  for (int i = 0; i < G[v].size(); i++)
    if (now != v || (i < cnt1 && cnt2 < i)) unit(G[v][i]);
  return;
}
void DFS1(int v) {
  if (vis[v]) return;
  vis[v] = true;
  for (int i = 0; i < G[v].size(); i++) DFS1(G[v][i]);
  V.push_back(v);
  return;
}
void DFS2(int v) {
  if (ord[v] != 0) return;
  ord[v] = cnt;
  for (int i = 0; i < R[v].size(); i++) DFS2(R[v][i]);
  return;
}
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 0; i < M; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    G[a].push_back(b);
    R[b].push_back(a);
    A[i] = a;
    B[i] = b;
    id[a].push_back(i);
  }
  memset(vis, false, sizeof(vis));
  cnt = 0;
  for (int i = 1; i <= N; i++)
    if (!vis[i]) DFS1(i);
  reverse(V.begin(), V.end());
  for (int i = 1; i <= N; i++)
    if (ord[i] == 0) cnt++, DFS2(i);
  for (int i = 1; i <= N; i++) {
    now++;
    memset(mem, 0, sizeof(mem));
    memset(vis, false, sizeof(vis));
    cnt1 = cnt2 = 0;
    for (int j = 0; j < G[i].size(); j++) {
      cnt1++;
      if (mem[B[id[i][j]]]) can[id[i][j]] = true;
      unit(G[i][j]);
    }
    memset(mem, 0, sizeof(mem));
    memset(vis, false, sizeof(vis));
    cnt1 = cnt2 = G[i].size() - 1;
    for (int j = G[i].size() - 1; j >= 0; j--) {
      cnt2--;
      if (mem[B[id[i][j]]]) can[id[i][j]] = true;
      unit(G[i][j]);
    }
  }
  for (int i = 0; i < M; i++) {
    int a = A[i], b = B[i];
    if (ord[a] != ord[b]) {
      if (can[i])
        printf("diff\n");
      else
        printf("same\n");
    } else {
      if (can[i])
        printf("same\n");
      else
        printf("diff\n");
    }
  }
  return 0;
}
