#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && (ch != '-')) ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int const MAXN = 1005;
struct Edges { int to, next; } e[200005];
struct Edge { int x, y; } G[200005];
int head[MAXN], tot;
int vis[MAXN];
int A[MAXN][MAXN], B[MAXN][MAXN];
int stk[200005];

inline void addedge(int from, int to) {
  e[++tot] = (Edges){to, head[from]};
  head[from] = tot;
}

void Dfs(int now, int id) {
  vis[now] = 1;
  A[id][now] = 1;
  for (RI i = head[now]; i; i = e[i].next)
    if (!vis[e[i].to]) Dfs(e[i].to, id);
}
void DDfs(int now, int id, int tmp) {
  vis[now] = 1;
  if (now != tmp) B[id][now] = 1;
  for (RI i = head[now]; i; i = e[i].next)
    if (!vis[e[i].to]) DDfs(e[i].to, id, tmp);
}

int main() {

#ifdef LOCAL
  FILEIO("a");
#endif

  int n, m; read(n), read(m);
  for (RI i = 1; i <= m; ++i)
    read(G[i].x), read(G[i].y), addedge(G[i].x, G[i].y);
  for (RI i = 1; i <= n; ++i) {
    memset(vis, 0, sizeof(vis));
    Dfs(i, i);
  }
  for (RI i = 1; i <= n; ++i) {
    int top = 0;
    for (RI j = head[i]; j; j = e[j].next)
      stk[++top] = e[j].to;
    memset(vis, 0, sizeof(vis)); vis[i] = 1;
    for (RI j = 1; j <= top; ++j)
      if (!vis[stk[j]]) DDfs(stk[j], i, stk[j]);
    memset(vis, 0, sizeof(vis)); vis[i] = 1;
    for (RI j = top; j; --j)
      if (!vis[stk[j]]) DDfs(stk[j], i, stk[j]);
  }
  for (RI i = 1; i <= m; ++i)
    if (A[G[i].y][G[i].x] ^ B[G[i].x][G[i].y])
      puts("diff");
    else puts("same");


  cerr << (double)(clock()) / CLOCKS_PER_SEC * 1000 << "ms" << endl;

  return 0;
}

// created by Daniel yuan