#include <bits/stdc++.h>
using namespace std;
vector<int> G[1010];
int a[200010], b[200010], vis[2][1010][1010];
void dfs(int mod, int a, int b, int col) {
  if (vis[mod][a][b]) return;
  vis[mod][a][b] = col;
  for (auto q : G[b]) dfs(mod, a, q, col);
}
int main() {
  int i, j, n, m;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &a[i], &b[i]);
    G[a[i]].push_back(b[i]);
  }
  for (i = 1; i <= n; i++) {
    vis[0][i][i] = vis[1][i][i] = 1;
    for (j = 0; j < G[i].size(); j++) dfs(0, i, G[i][j], j + 1);
    for (j = G[i].size() - 1; j >= 0; j--) dfs(1, i, G[i][j], j + 1);
  }
  for (i = 1; i <= m; i++) {
    int x = (vis[0][a[i]][b[i]] != vis[1][a[i]][b[i]]);
    int y = vis[0][b[i]][a[i]];
    if (x ^ y)
      printf("diff\n");
    else
      printf("same\n");
  }
  return 0;
}
