#include <bits/stdc++.h>
using namespace std;
vector<int> g[200001];
int n, m, op[1001][1001], a[200001], b[200001];
inline void read(int &x) {
  int a;
  scanf("%d", &a);
  x = a;
}
bool visit[1001] = {false};
void dfs(int u, int c) {
  visit[u] = true;
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (!visit[v]) {
      op[c][v]++;
      dfs(v, c);
    }
  }
  visit[u] = false;
}
int main() {
  read(n);
  read(m);
  for (int i = 1; i <= m; i++) {
    read(a[i]);
    read(b[i]);
    g[a[i]].push_back(b[i]);
  }
  for (int i = 1; i <= n; i++) dfs(i, i);
  for (int i = 1; i <= m; i++) {
    if (op[a[i]][b[i]] && op[b[i]][a[i]]) {
      if (op[a[i]][b[i]] == 1)
        printf("diff\n");
      else
        printf("same\n");
    } else {
      if (op[a[i]][b[i]] == 1)
        printf("same\n");
      else
        printf("diff\n");
    }
  }
}
