#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000;
const int MAXM = 200000;
struct edge {
  int to, id;
  edge *nxt;
} edges[MAXM + 5], *adj[MAXN + 5], *ecnt = edges;
void addedge(int u, int v, int i) {
  edge *p = (++ecnt);
  p->to = v, p->id = i, p->nxt = adj[u], adj[u] = p;
}
bool ans1[MAXM + 5], ans2[MAXM + 5];
int tag[MAXN + 5];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    addedge(a, b, i);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) tag[j] = 0;
    queue<pair<int, int> > que;
    for (edge *p = adj[i]; p; p = p->nxt)
      que.push(make_pair(p->to, tag[p->to] = p->id));
    while (!que.empty()) {
      pair<int, int> f = que.front();
      que.pop();
      int x = f.first, y = f.second;
      for (edge *p = adj[x]; p; p = p->nxt) {
        if (p->to == i)
          ans1[p->id] = 1;
        else {
          if (tag[p->to] != -1) {
            if (tag[p->to] == 0)
              que.push(make_pair(p->to, tag[p->to] = y));
            else if (tag[p->to] != y)
              que.push(make_pair(p->to, tag[p->to] = -1));
          }
        }
      }
    }
    for (edge *p = adj[i]; p; p = p->nxt)
      if (tag[p->to] == -1) ans2[p->id] = 1;
  }
  for (int i = 1; i <= m; i++) puts(ans1[i] ^ ans2[i] ? "diff" : "same");
}
