#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAX = 2e5 + 5;
const int MOD = 1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <class T>
inline void read(T& num) {
  bool start = false, neg = false;
  char c;
  num = 0;
  while ((c = getchar()) != EOF) {
    if (c == '-')
      start = neg = true;
    else if (c >= '0' && c <= '9') {
      start = true;
      num = num * 10 + c - '0';
    } else if (start)
      break;
  }
  if (neg) num = -num;
}
inline long long powMM(long long a, long long b, long long M) {
  long long ret = 1;
  a %= M;
  while (b) {
    if (b & 1) ret = ret * a % M;
    b >>= 1;
    a = a * a % M;
  }
  return ret;
}
void open() {
  freopen("in2.txt", "r", stdin);
  freopen("out2.txt", "w", stdout);
}
const int maxn = 1e3 + 5;
vector<int> G[maxn];
int n, m;
int a[MAX], b[MAX];
int da[1005][1005], xiao[1005][1005];
bool vi[1005];
void dfs(int now, int id, int st, int x[1005][1005]) {
  vi[now] = true;
  if (x[st][now] == -1) x[st][now] = id;
  for (int u : G[now])
    if (!vi[u] && u != st) dfs(u, id, st, x);
}
void solve(int st) {
  for (int i = 0; i < G[st].size(); i++) {
    int to = G[st][i];
    memset(vi, false, sizeof(vi));
    vi[st] = 1;
    dfs(to, i, st, xiao);
  }
  memset(vi, false, sizeof(vi));
  for (int i = G[st].size() - 1; i >= 0; i--) {
    int to = G[st][i];
    memset(vi, false, sizeof(vi));
    vi[st] = 1;
    dfs(to, i, st, da);
  }
}
int main() {
  read(n);
  read(m);
  memset(da, -1, sizeof(da));
  memset(xiao, -1, sizeof(xiao));
  for (int i = 1; i <= m; i++) {
    read(a[i]);
    read(b[i]);
    G[a[i]].push_back(b[i]);
  }
  for (int i = 1; i <= n; i++) solve(i);
  for (int i = 1; i <= m; i++) {
    if ((da[a[i]][b[i]] != xiao[a[i]][b[i]]) == (da[b[i]][a[i]] != -1))
      printf("same\n");
    else
      printf("diff\n");
  }
}
