#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e3 + 7, maxm = 1e5 + 7;
int c[2][maxn][maxn];
vector<int> G[maxn];
int a[maxm], b[maxm];
void dfs(int x, int st, int ptr, bool typ) {
  if (!c[typ][st][x])
    c[typ][st][x] = ptr;
  else
    return;
  for (int y : G[x])
    if (!c[typ][st][y]) dfs(y, st, ptr, typ);
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; ++i)
    scanf("%d%d", &a[i], &b[i]), G[a[i]].push_back(b[i]);
  for (int x = 1; x <= n; ++x) {
    c[0][x][x] = c[1][x][x] = 1;
    for (auto y : G[x]) dfs(y, x, y, 0);
    reverse(G[x].begin(), G[x].end());
    for (auto y : G[x]) dfs(y, x, y, 1);
  }
  for (int i = 1; i <= m; ++i) {
    bool flag = (c[0][b[i]][a[i]] > 0);
    if (c[0][a[i]][b[i]] != c[1][a[i]][b[i]]) flag ^= 1;
    if (flag)
      puts("diff");
    else
      puts("same");
  }
  return 0;
}
