#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
const long long LINF = 2e16;
const int magic = 348;
const int MOD = 1e9 + 7;
const double eps = 1e-10;
const double pi = acos(-1);
struct fastio {
  static const int S = 1e7;
  char rbuf[S + 48], wbuf[S + 48];
  int rpos, wpos, len;
  fastio() { rpos = len = wpos = 0; }
  inline char Getchar() {
    if (rpos == len) rpos = 0, len = fread(rbuf, 1, S, stdin);
    if (!len) return EOF;
    return rbuf[rpos++];
  }
  template <class T>
  inline void Get(T &first) {
    char ch;
    bool f;
    T res;
    while (!isdigit(ch = Getchar()) && ch != '-') {
    }
    if (ch == '-')
      f = false, res = 0;
    else
      f = true, res = ch - '0';
    while (isdigit(ch = Getchar())) res = res * 10 + ch - '0';
    first = (f ? res : -res);
  }
  inline void getstring(char *s) {
    char ch;
    while ((ch = Getchar()) <= 32) {
    }
    for (; ch > 32; ch = Getchar()) *s++ = ch;
    *s = '\0';
  }
  inline void flush() {
    fwrite(wbuf, 1, wpos, stdout);
    fflush(stdout);
    wpos = 0;
  }
  inline void Writechar(char ch) {
    if (wpos == S) flush();
    wbuf[wpos++] = ch;
  }
  template <class T>
  inline void Print(T first, char ch) {
    char s[20];
    int pt = 0;
    if (first == 0)
      s[++pt] = '0';
    else {
      if (first < 0) Writechar('-'), first = -first;
      while (first) s[++pt] = '0' + first % 10, first /= 10;
    }
    while (pt) Writechar(s[pt--]);
    Writechar(ch);
  }
  inline void printstring(char *s) {
    int pt = 1;
    while (s[pt] != '\0') Writechar(s[pt++]);
  }
} io;
template <typename T>
inline void check_max(T &first, T cmp) {
  first = max(first, cmp);
}
template <typename T>
inline void check_min(T &first, T cmp) {
  first = min(first, cmp);
}
template <typename T>
inline T myabs(T first) {
  return first >= 0 ? first : -first;
}
template <typename T>
inline T gcd(T first, T second) {
  return second == 0 ? first : gcd(second, first % second);
}
inline int add(int first) {
  if (first >= MOD) first -= MOD;
  return first;
}
inline int add(int first, int MO) {
  if (first >= MO) first -= MO;
  return first;
}
inline int sub(int first) {
  if (first < 0) first += MOD;
  return first;
}
inline int sub(int first, int MO) {
  if (first < 0) first += MO;
  return first;
}
inline void Add(int &first, int second) { first = add(first + second); }
inline void Add(int &first, int second, int MO) {
  first = add(first + second, MO);
}
inline void Sub(int &first, int second) { first = sub(first - second); }
inline void Sub(int &first, int second, int MO) {
  first = sub(first - second, MO);
}
template <typename T>
inline int quick_pow(int first, T second) {
  int res = 1;
  while (second) {
    if (second & 1) res = 1ll * res * first % MOD;
    first = 1ll * first * first % MOD;
    second >>= 1;
  }
  return res;
}
template <typename T>
inline int quick_pow(int first, T second, int MO) {
  int res = 1;
  while (second) {
    if (second & 1) res = 1ll * res * first % MO;
    first = 1ll * first * first % MO;
    second >>= 1;
  }
  return res;
}
const int MAXN = 2000;
const int MAXM = 2e5;
int n, m;
vector<pair<int, int> > v[MAXN + 48];
vector<int> vv[MAXN + 48];
bool visited1[MAXN + 48], visited2[MAXN + 48], visited3[MAXN + 48],
    ok[MAXN + 48];
int ans[MAXM + 48];
inline void dfs1(int cur) {
  visited1[cur] = true;
  for (register int i = 0; i < int(vv[cur].size()); i++) {
    register int second = vv[cur][i];
    if (!visited1[second]) dfs1(second);
  }
}
inline void dfs2(int cur) {
  visited2[cur] = true;
  for (register int i = 0; i < int(v[cur].size()); i++) {
    register int second = v[cur][i].first;
    if (!visited2[second]) dfs2(second);
  }
}
int main() {
  double TIME = clock();
  freopen("a.in", "r", stdin);
  freopen("a.out", "w", stdout);
  cerr << "Running..." << endl;
  io.Get(n);
  io.Get(m);
  int first, second;
  for (register int i = 1; i <= m; i++) {
    io.Get(first);
    io.Get(second);
    v[first].push_back(make_pair(second, i));
    vv[second].push_back(first);
  }
  for (register int i = 1; i <= n; i++) {
    memset(visited1, false, sizeof(visited1));
    memset(visited2, false, sizeof(visited2));
    memset(ok, false, sizeof(ok));
    dfs1(i);
    visited2[i] = true;
    for (register int j = 0; j < int(v[i].size()) - 1; j++) {
      dfs2(v[i][j].first);
      for (register int k = j + 1; k < int(v[i].size()); k++)
        if (visited2[v[i][k].first]) ok[v[i][k].first] = true;
    }
    memset(visited2, false, sizeof(visited2));
    for (register int j = int(v[i].size()) - 1; j >= 1; j--) {
      dfs2(v[i][j].first);
      for (register int k = j - 1; k >= 0; k--)
        if (visited2[v[i][k].first]) ok[v[i][k].first] = true;
    }
    for (register int j = 0; j < int(v[i].size()); j++)
      ans[v[i][j].second] = (visited1[v[i][j].first] ^ ok[v[i][j].first]);
  }
  for (register int i = 1; i <= m; i++) printf(ans[i] ? "diff\n" : "same\n");
  io.flush();
  cerr << "Exec Time: " << (clock() - TIME) / CLOCKS_PER_SEC << endl;
  return 0;
}
