#include <bits/stdc++.h>
using namespace std;
bool f[1050][1050], g[1050][1050], vis[1050];
int n, m;
vector<int> h[1050];
pair<int, int> a[205030];
void dfs(int rt, int u, int o) {
  if (o > 0) vis[u] = true, f[rt][u] = true;
  for (int i = 0; i < h[u].size(); i++) {
    int v = h[u][i];
    if (!vis[v]) dfs(rt, v, o + 1);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a[i].first, &a[i].second);
    h[a[i].first].push_back(a[i].second);
  }
  for (int i = 1; i <= n; i++) {
    memset(vis, 0, sizeof(vis));
    dfs(i, 1, -1);
    for (int j = 1; j <= n; j++) g[i][j] = f[i][j], f[i][j] = false;
    dfs(i, 1, 0);
  }
  for (int i = 0; i < m; i++)
    if (f[a[i].second][a[i].first] ^ g[a[i].first][a[i].second])
      printf("diff\n");
    else
      printf("same\n");
  return 0;
}
