#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#define FILL(a, n, x) memset((a), (x), sizeof ((a)[0]) * (n))
#define COPY(a, n, b) memcpy((b), (a), sizeof ((a)[0]) * (n))
using namespace std;

const int maxn = 1000, maxm = 2e5;
typedef pair<int, int> pii;

int n, m;
vector<pii> g[maxn];
int ans1[maxm], ans2[maxm];
bool reach[maxn][maxn];
bool vis[maxn];

int Min[maxn], Max[maxn];

void Dfs1(int u) {
  vis[u] = true;
  for (auto x : g[u]) {
    int v = x.first;
    if (!vis[v]) {
      Dfs1(v);
    }
  }
}

void Dfs2(int u, int ban, int *label, int value) {
  label[u] = value;
  for (auto x : g[u]) {
    int v = x.first;
    if (v != ban && label[v] == -1) {
      Dfs2(v, ban, label, value);
    }
  }
}

int main(void) {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a; --b;
    g[a].push_back(make_pair(b, i));
  }
  for (int i = 0; i < n; ++i) {
    FILL(vis, n, 0);
    Dfs1(i);
    COPY(vis, n, reach[i]);
  }
  for (int i = 0; i < n; ++i) {
    for (auto x : g[i]) {
      int j = x.first, id = x.second;
      ans2[id] = reach[j][i];
    }
  }
  for (int p = 0; p < n; ++p) {
    FILL(Min, n, -1);
    for (int i = 0; i < g[p].size(); ++i) {
      int q = g[p][i].first;
      if (Min[q] == -1) Dfs2(q, p, Min, i);
    }
    FILL(Max, n, -1);
    for (int i = (int)g[p].size() - 1; i >= 0; --i) {
      int q = g[p][i].first;
      if (Max[q] == -1) Dfs2(q, p, Max, i);
    }
    for (auto x : g[p]) {
      int q = x.first, id = x.second;
      ans1[id] = (Min[q] != -1 && Min[q] != Max[q]);
    }
  }
  for (int i = 0; i < m; ++i) {
    puts(ans1[i] == ans2[i] ? "same" : "diff");
  }
  return 0;
}
