#include <bits/stdc++.h>
using namespace std;
int read() {
  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 << 1) + (x << 3) + ch - '0', ch = getchar();
  return x * f;
}
const int N = 1005;
vector<int> vec[N];
int now, x[N], y[N], n, m, vis1[N][N], vis2[N][N];
void dfs1(int x, int fa) {
  for (int i = 0; i < vec[x].size(); i++)
    if (vec[x][i] != fa)
      if (!vis1[now][vec[x][i]]) vis1[now][vec[x][i]] = x, dfs1(vec[x][i], x);
}
void dfs2(int x, int fa) {
  for (int i = vec[x].size() - 1; i >= 0; i--)
    if (vec[x][i] != fa)
      if (!vis2[now][vec[x][i]]) vis2[now][vec[x][i]] = x, dfs2(vec[x][i], x);
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= m; i++)
    x[i] = read(), y[i] = read(), vec[x[i]].push_back(y[i]);
  for (int i = 1; i <= n; i++) {
    now = i;
    vis1[now][now] = vis2[now][now] = 1;
    dfs1(i, -1);
    dfs2(i, -1);
  }
  for (int i = 1; i <= m; i++)
    puts(((vis1[y[i]][x[i]] != 0) ^
          (vis1[x[i]][y[i]] != x[i] || vis2[x[i]][y[i]] != x[i]))
             ? "diff"
             : "same");
  return 0;
}
