#include <bits/stdc++.h>
using namespace std;
int n, m, u, v;
int id[1005][1005], d[1005][1005], d2[1005][1005], q[1005][2];
int ans[200005];
vector<int> a[1005];
void dfs(int x, int fa) {
  d[fa][x] = 1;
  for (int i = 0; i < (int)a[x].size(); i++)
    if (d[fa][a[x][i]] == 0) dfs(a[x][i], fa);
}
void dfs1(int x, int f, int flag) {
  q[x][flag] = f;
  for (int i = 0; i < (int)a[x].size(); i++)
    if (!q[a[x][i]][flag]) dfs1(a[x][i], f, flag);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    id[u][v] = i;
    a[u].push_back(v);
  }
  for (int i = 1; i <= n; i++) dfs(i, i);
  for (int i = 1; i <= n; i++) {
    memset(q, 0, sizeof q);
    for (int j = 0; j < (int)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 < (int)a[i].size(); j++)
      if (q[a[i][j]][0] != j + 1 || q[a[i][j]][1] != j + 1) d2[i][a[i][j]] = 1;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (d[j][i] == d2[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");
  }
}
