#include <bits/stdc++.h>
const int N = 1005;
int n, m, a[N][N], b[N][N], Ans[200005];
std::vector<int> G[N], Q[N];
void DFS(int x, int c, int *Mark) {
  if (Mark[x]) return;
  Mark[x] = c;
  for (int y : G[x])
    if (!Mark[y]) DFS(y, c, Mark);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, x, y; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    G[x].push_back(y);
    Q[x].push_back(i);
  }
  for (int i = 1; i <= n; ++i) {
    a[i][i] = b[i][i] = -1;
    for (int j = 0; j <= (int)G[i].size() - 1; ++j) DFS(G[i][j], j + 1, a[i]);
    for (int j = (int)G[i].size() - 1; j >= 0; --j) DFS(G[i][j], j + 1, b[i]);
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < (int)G[i].size(); ++j) {
      int x = a[G[i][j]] ? 1 : 0,
          y = a[i][G[i][j]] <= j || b[i][G[i][j]] > j + 1;
      Ans[Q[i][j]] = x != y;
    }
  for (int i = 1; i <= m; ++i) puts(Ans[i] ? "diff" : "same");
  return 0;
}
