#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[N][N], ans[2][N], p[2][N];
long long eu[M], ev[M], n, m;
void dfs_vis(long long u, long long rt) {
  vis[rt][u] = 1;
  for (long long i = 0; i < G[u].size(); i++) {
    long long v = ev[G[u][i]];
    if (vis[rt][v]) continue;
    dfs_vis(v, rt);
  }
}
void get_vis() {
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) vis[i][j] = 0;
    dfs_vis(i, i);
  }
  for (long long i = 1; i <= m; i++) {
    if (vis[ev[i]][eu[i]])
      ans[0][i] = 1;
    else
      ans[0][i] = 0;
  }
}
void dfs_sol(long long u, long long col, long long pid) {
  p[pid][u] = col;
  for (long long i = 0; i < G[u].size(); i++) {
    long long v = ev[G[u][i]];
    if (p[pid][v]) continue;
    dfs_sol(v, col, pid);
  }
}
void solve(long long u) {
  for (long long i = 1; i <= n; i++) p[0][i] = p[1][i] = 0;
  p[0][u] = p[1][u] = u;
  for (long long i = 0; i < G[u].size(); i++)
    if (!p[0][ev[G[u][i]]]) dfs_sol(ev[G[u][i]], G[u][i], 0);
  for (long long i = (long long)(G[u].size()) - 1; i >= 0; i--)
    if (!p[1][ev[G[u][i]]]) dfs_sol(ev[G[u][i]], G[u][i], 1);
  for (long long i = 0; i < G[u].size(); i++) {
    long long v = ev[G[u][i]];
    if (p[0][v] != p[1][v])
      ans[1][G[u][i]] = 1;
    else
      ans[1][G[u][i]] = 0;
  }
}
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();
  for (long long i = 1; i <= n; i++) solve(i);
  for (long long i = 1; i <= m; i++)
    cout << ((ans[0][i] ^ ans[1][i]) ? "diff" : "same") << '\n';
  return 0;
}
