#include <bits/stdc++.h>
using namespace std;
int n, m, u, v;
int id[1010][1010], ans1[1010][1010], ans2[1010][1010], q[1010][2];
int ans[1010];
vector<int> a[1010];
void dfs(int x, int fa) {
  ans1[fa][x] = 1;
  for (int i = 0; i < a[x].size(); i++)
    if (ans1[fa][a[x][i]] == 0) dfs(a[x][i], fa);
}
void dfs1(int x, int tag, int flag) {
  q[x][flag] = tag;
  for (int i = 0; i < a[x].size(); i++)
    if (!q[a[x][i]][flag]) dfs1(a[x][i], tag, flag);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &u, &v);
    u--;
    v--;
    id[u][v] = i + 1;
    a[u].push_back(v);
  }
  for (int i = 0; i < n; i++) dfs(i, i);
  for (int i = 0; i < n; i++) {
    memset(q, 0, sizeof q);
    q[i][0] = q[i][1] = -1;
    for (int j = 0; j < a[i].size(); j++)
      if (!q[a[i][j]][0]) dfs1(a[i][j], j + 1, 0);
    for (int j = a[i].size() - 1; j >= 0; j--)
      if (!q[a[i][j]][1]) dfs1(a[i][j], j + 1, 1);
    for (int j = 0; j < a[i].size(); j++)
      if (q[a[i][j]][0] != j + 1 || q[a[i][j]][1] != j + 1)
        ans2[i][a[i][j]] = 1;
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (ans1[j][i] == ans2[i][j] && id[i][j]) ans[id[i][j]] = 1;
  for (int i = 1; i <= m; i++) {
    if (ans[i] == 1)
      printf("same\n");
    else
      printf("diff\n");
  }
}
