#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
vector<int> G[N];
int a[N], b[N], vis[N], w[N][N], p[N][N], q[N][N];
int n, m;
void dfs(int u, int x) {
  vis[u] = 1, w[x][u] = 1;
  for (auto v : G[u])
    if (!vis[v]) dfs(v, x);
}
void dfs2(int u, int x, bool ch) {
  for (auto v : G[u])
    if (v != x && !vis[v]) {
      vis[v] = vis[u];
      dfs2(v, x, ch);
    }
  if (!ch)
    p[x][u] = vis[u];
  else
    q[x][u] = vis[u];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> a[i] >> b[i];
    G[a[i]].push_back(b[i]);
  }
  for (int i = 1; i <= n; i++) {
    memset(vis, 0, sizeof(vis));
    dfs(i, i);
  }
  for (int i = 1; i <= n; i++) {
    memset(vis, 0, sizeof(vis));
    int SZ = G[i].size();
    for (int j = 0; j < SZ; j++) {
      int v = G[i][j];
      if (!vis[v]) vis[v] = v, dfs2(v, i, 0);
    }
    memset(vis, 0, sizeof(vis));
    for (int j = SZ - 1; j >= 0; j--) {
      int v = G[i][j];
      if (!vis[v]) vis[v] = v, dfs2(v, i, 1);
    }
  }
  for (int i = 1; i <= m; i++) {
    int x = w[b[i]][a[i]];
    int y = (p[a[i]][b[i]] != b[i] || q[a[i]][b[i]] != b[i]);
    if (x == y)
      cout << "same" << endl;
    else
      cout << "diff" << endl;
  }
  return 0;
}
