#include <bits/stdc++.h>
using namespace std;
vector<int> G[1010];
int to[200010], tag[1010], q[2 * 1010];
bool ans1[200010], ans2[200010];
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
signed main() {
  int n = read(), m = read();
  for (int i = 1; i <= m; ++i) {
    int x = read();
    to[i] = read();
    G[x].push_back(i);
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) tag[j] = 0;
    int t = 1, w = 0;
    for (auto &x : G[i]) {
      q[++w] = to[x];
      tag[to[x]] = x;
    }
    while (t <= w) {
      int x = q[t++], y = tag[x];
      for (auto &p : G[x]) {
        int tmp = to[p];
        if (tmp != i) {
          if (tag[tmp] != 1) {
            if (tag[tmp] == 0) {
              q[++w] = tmp;
              tag[tmp] = y;
            } else if (tag[tmp] != y) {
              q[++w] = tmp;
              tag[tmp] = -1;
            }
          }
        } else
          ans1[p] = 1;
      }
    }
    for (auto &x : G[i]) {
      if (tag[to[x]] == -1) ans2[x] = 1;
    }
  }
  for (int i = 1; i <= m; ++i) puts(ans1[i] ^ ans2[i] ? "diff" : "same");
  return 0;
}
