#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T lcm(T a, T b) {
  a = abs(a);
  b = abs(b);
  return (a / gcd(a, b)) * b;
}
template <class T, class X>
inline bool getbit(T a, X i) {
  T t = 1;
  return ((a & (t << i)) > 0);
}
template <class T, class X>
inline T setbit(T a, X i) {
  T t = 1;
  return (a | (t << i));
}
template <class T, class X>
inline T resetbit(T a, X i) {
  T t = 1;
  return (a & (~(t << i)));
}
inline long long getnum() {
  char c = getchar();
  long long num, sign = 1;
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') sign = -1;
  for (num = 0; c >= '0' && c <= '9';) {
    c -= '0';
    num = num * 10 + c;
    c = getchar();
  }
  return num * sign;
}
inline long long power(long long a, long long b) {
  long long multiply = 1;
  for (int i = (0); i < (b); i++) {
    multiply *= a;
  }
  return multiply;
}
int n, m;
vector<int> graph[1005], ids[1005];
bool visited[1005][1005][2], reach[1005][1005];
int way[1005][1005][2];
string ans[2 * 1005];
void dfs(int u, int beg, int id, bool fl) {
  if (visited[beg][u][fl]) return;
  way[beg][u][fl] = id;
  visited[beg][u][fl] = true;
  for (auto v : graph[u]) {
    if (v == beg) continue;
    dfs(v, beg, id, fl);
  }
}
void dfs(int u, int beg) {
  if (reach[beg][u]) return;
  reach[beg][u] = true;
  for (auto v : graph[u]) {
    dfs(v, beg);
  }
}
void solve() {
  for (int i = (1); i < (n + 1); i++) {
    dfs(i, i);
  }
  for (int i = (1); i < (n + 1); i++) {
    for (int j = (0); j < (graph[i].size()); j++) {
      int v = graph[i][j];
      int id = ids[i][j];
      dfs(v, i, id, 0);
    }
    for (int j = ((int)graph[i].size() - 1); j >= (0); j--) {
      int v = graph[i][j];
      int id = ids[i][j];
      dfs(v, i, id, 1);
    }
    for (int j = (0); j < (graph[i].size()); j++) {
      int v = graph[i][j];
      int id = ids[i][j];
      if (way[i][v][0] == way[i][v][1]) {
        if (!reach[v][i])
          ans[id] = "same";
        else
          ans[id] = "diff";
      } else {
        if (reach[v][i])
          ans[id] = "same";
        else
          ans[id] = "diff";
      }
    }
  }
  for (int i = (0); i < (m); i++) printf("%s\n", ans[i].c_str());
}
int main() {
  int test, cases = 1;
  scanf("%d%d", &n, &m);
  int u, v;
  for (int i = (0); i < (m); i++) {
    scanf("%d%d", &u, &v);
    graph[u].push_back(v);
    ids[u].push_back(i);
  }
  solve();
  return 0;
}
