#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chkmin(T &x, T y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
bool chkmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
int readint() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m, tot;
int vis[1005], c[1005][1005], d[1005][1005], v[200005], nxt[200005], id[200005],
    h[1005];
bool ans[200005];
void addedge(int x, int y, int z) {
  v[++tot] = y;
  id[tot] = z;
  nxt[tot] = h[x];
  h[x] = tot;
}
void dfs1(int u, int f) {
  c[f][u] = 1;
  for (int p = h[u]; p; p = nxt[p]) {
    if (vis[v[p]]) continue;
    vis[v[p]] = 1;
    dfs1(v[p], f);
  }
}
void dfs2(int u, int x, int f) {
  for (int p = h[u]; p; p = nxt[p]) {
    if (v[p] == x || vis[v[p]]) continue;
    vis[v[p]] = f;
    dfs2(v[p], x, f);
  }
}
int main() {
  n = readint();
  m = readint();
  int x, y;
  for (int i = 1; i <= m; i++) {
    x = readint();
    y = readint();
    addedge(x, y, i);
  }
  for (int i = 1; i <= n; i++) {
    memset(vis, 0, sizeof(vis));
    vis[i] = 1;
    dfs1(i, i);
  }
  for (int i = 1; i <= n; i++) {
    memset(vis, 0, sizeof(vis));
    vector<int> adj(0);
    for (int p = h[i]; p; p = nxt[p]) adj.push_back(v[p]);
    for (auto v : adj) {
      if (!vis[v]) {
        vis[v] = v;
        dfs2(v, i, v);
      }
    }
    for (auto v : adj)
      if (vis[v] != v) d[i][v] = 1;
    reverse(adj.begin(), adj.end());
    memset(vis, 0, sizeof(vis));
    for (auto v : adj) {
      if (!vis[v]) {
        vis[v] = v;
        dfs2(v, i, v);
      }
    }
    for (auto v : adj)
      if (vis[v] != v) d[i][v] = 1;
  }
  for (int i = 1; i <= n; i++)
    for (int p = h[i]; p; p = nxt[p])
      if (c[v[p]][i] == d[i][v[p]]) ans[id[p]] = 1;
  for (int i = 1; i <= m; i++) {
    if (ans[i])
      printf("same\n");
    else
      printf("diff\n");
  }
  return 0;
}
