#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char ch = getchar();
  int x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int p[2010][2010], q[2010][2010];
int T;
vector<int> G[2010];
int vis[2010];
inline void dfs(int st, int x, int id, int a[]) {
  if (st == x || vis[x] == T) return;
  vis[x] = T;
  a[x] = id;
  for (int i = 0; i < G[x].size(); ++i) {
    dfs(st, G[x][i], id, a);
  }
}
pair<int, int> A[2010 * 50];
int main() {
  int n = read(), m = read();
  for (int i = (1); i <= (m); ++i) {
    int u = read(), v = read();
    G[u].push_back(v);
    A[i] = make_pair(u, v);
  }
  for (int i = (1); i <= (n); ++i) {
    ++T;
    int id = 0;
    for (int j = 0; j < G[i].size(); ++j) {
      dfs(i, G[i][j], ++id, p[i]);
    }
    reverse(G[i].begin(), G[i].end());
    ++T;
    for (int j = 0; j < G[i].size(); ++j) {
      dfs(i, G[i][j], id--, q[i]);
    }
  }
  for (int i = (1); i <= (m); ++i) {
    int u = A[i].first, v = A[i].second;
    if ((q[u][v] > 0) == (p[u][v] != q[u][v])) {
      puts("same");
    } else
      puts("diff");
  }
  return 0;
}
