#include <bits/stdc++.h>
using namespace std;
const long long N = 2005;
const long long M = 400005;
vector<long long> G[N];
long long vis[2][N][N], p[N], vi[N];
long long eu[M], ev[M], n, m;
void dfs_vis(long long u, long long rt) {
  vis[0][rt][u] = 1;
  for (long long i = 0; i < G[u].size(); i++) {
    long long v = ev[G[u][i]];
    if (vis[0][rt][v]) continue;
    dfs_vis(v, rt);
  }
}
void get_vis() {
  for (long long i = 1; i <= n; i++) dfs_vis(i, i);
}
void dfs_sol(long long u, long long col, long long pid, long long rt) {
  if (pid)
    vis[1][rt][u] = (p[u] != col);
  else
    p[u] = col;
  vi[u] = 1;
  for (long long i = 0; i < G[u].size(); i++) {
    long long v = ev[G[u][i]];
    if (vi[v]) continue;
    dfs_sol(v, col, pid, rt);
  }
}
void solve(long long u) {
  memset(p, 0, sizeof(p));
  memset(vi, 0, sizeof(vi));
  vi[u] = 1;
  for (long long i = 0; i < G[u].size(); i++)
    if (!vi[ev[G[u][i]]]) dfs_sol(ev[G[u][i]], i + 1, 0, u);
  memset(vi, 0, sizeof(vi));
  vi[u] = 1;
  for (long long i = (long long)(G[u].size()) - 1; i >= 0; i--)
    if (!vi[ev[G[u][i]]]) dfs_sol(ev[G[u][i]], i + 1, 1, u);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) {
    cin >> eu[i] >> ev[i];
    G[eu[i]].push_back(i);
  }
  get_vis();
  memset(vis, 0, sizeof(vis));
  for (long long i = 1; i <= n; i++) solve(i);
  for (long long i = 1; i <= m; i++)
    cout << ((vis[0][ev[i]][eu[i]] ^ vis[1][eu[i]][ev[i]]) ? "diff" : "same")
         << '\n';
  return 0;
}
