#include <bits/stdc++.h>
using namespace std;
template <typename T>
void cmin(T &x, const T &y) {
  if (y < x) x = y;
}
template <typename T>
void cmax(T &x, const T &y) {
  if (y > x) x = y;
}
template <typename T>
void read(T &x) {
  x = 0;
  char c = getchar();
  bool f = 0;
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') f = 1, c = getchar();
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  if (f) x = -x;
}
const int MV = 1003;
const int ME = 200005;
int n, m;
int fst[MV], nxt[ME], u[ME], v[ME], lnum;
int way1[MV][MV], way2[MV][MV], dir[MV][MV];
void addeg(int nu, int nv) {
  nxt[++lnum] = fst[nu];
  fst[nu] = lnum;
  u[lnum] = nu;
  v[lnum] = nv;
}
void input() {
  read(n), read(m);
  for (int i = 1; i <= m; i++) {
    int a, b;
    read(a), read(b);
    dir[a][b]++;
    addeg(a, b);
  }
}
bool ban[MV];
void dfs(int x, int *s) {
  if (!ban[x]) s[x]++;
  for (int i = fst[x]; i; i = nxt[i])
    if (!s[v[i]] && !ban[v[i]]) dfs(v[i], s);
}
void work() {
  for (int x = 1; x <= n; x++) {
    ban[x] = 1;
    vector<int> out;
    for (int i = fst[x]; i; i = nxt[i]) out.push_back(v[i]);
    for (int i = 0; i < out.size(); i++)
      ban[out[i]] = 1, dfs(out[i], way1[x]), ban[out[i]] = 0;
    for (int i = out.size() - 1; i >= 0; i--)
      ban[out[i]] = 1, dfs(out[i], way2[x]), ban[out[i]] = 0;
    ban[x] = 0;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) dir[i][j] += way1[i][j] + way2[i][j];
  for (int i = 1; i <= m; i++) {
    int a = u[i], b = v[i];
    if (dir[a][b] == 1 && !dir[b][a])
      puts("same");
    else if (dir[a][b] >= 2 && !dir[b][a])
      puts("diff");
    else if (dir[a][b] == 1 && dir[b][a])
      puts("diff");
    else if (dir[a][b] >= 2 && dir[b][a])
      puts("same");
  }
}
int main() {
  input();
  work();
  return 0;
}
