#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  x = 0;
  static int p;
  p = 1;
  static char c;
  c = getchar();
  while (!isdigit(c)) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ '0');
    c = getchar();
  }
  x *= p;
}
int n, m, e, e1;
int to[200100], beg[1010], nex[200100];
int to1[200100], beg1[1010], nex1[200100];
int vis[1010], stan[200100], stcn;
int cnt, pd, from[200100], from1[200100];
vector<int> s;
void add(int x, int y) {
  to[++e] = y;
  from[e] = x;
  nex[e] = beg[x];
  beg[x] = e;
}
void add1(int x, int y) {
  to1[++e1] = y;
  from1[e1] = x;
  nex1[e1] = beg1[x];
  beg1[x] = e1;
}
void dfs1(int x) {
  vis[x] = 1;
  if (to[pd] == x && !vis[from[pd]]) dfs1(from[pd]);
  for (int i = beg[x]; i; i = nex[i])
    if (i != pd && !vis[to[i]]) dfs1(to[i]);
  s.push_back(x);
}
void dfs2(int x) {
  vis[x] = 1;
  if (to1[pd] == x && !vis[from1[pd]]) dfs2(from1[pd]);
  for (int i = beg1[x]; i; i = nex1[i])
    if (i != pd && !vis[to1[i]]) dfs2(to1[i]);
}
int main() {
  read(n);
  read(m);
  for (int i = 1; i <= m; i++) {
    static int x, y;
    read(x);
    read(y);
    add(x, y);
    add1(y, x);
  }
  for (register int i = 1; i <= n; i++)
    if (!vis[i]) dfs1(i);
  memset(vis, 0, sizeof(vis));
  for (register int i = s.size() - 1; i >= 0; i--)
    if (!vis[s[i]]) cnt++, dfs2(s[i]);
  stcn = cnt;
  memset(vis, 0, sizeof(vis));
  for (int j = 1; j <= m; j++) {
    cnt = 0;
    pd = j;
    s.clear();
    for (register int i = 1; i <= n; i++)
      if (!vis[i]) dfs1(i);
    memset(vis, 0, sizeof(vis));
    for (register int i = s.size() - 1; i >= 0; i--)
      if (!vis[s[i]]) cnt++, dfs2(s[i]);
    memset(vis, 0, sizeof(vis));
    if (cnt != stcn)
      puts("diff");
    else
      puts("same");
  }
  return 0;
}
