#include <bits/stdc++.h>
using namespace std;
struct edge {
  int v, nxt;
} e[200050], e2[200050];
int head[1050], ecnt, hd[1050], ec;
int flg1[200050], flg2[200050];
int vis1[1050], vis2[1050];
void adde(int u, int v, int id) {
  e[++ecnt].v = v;
  e[ecnt].nxt = head[u];
  head[u] = ecnt;
  e2[++ec].v = u;
  e2[ec].nxt = hd[v];
  hd[v] = ec;
}
void dfs1(int pos, int tag) {
  vis1[pos] = tag;
  for (int i = head[pos]; i; i = e[i].nxt) {
    int v = e[i].v;
    if (!vis1[v]) dfs1(v, tag);
  }
}
void dfs2(int pos, int tag) {
  vis2[pos] = tag;
  for (int i = head[pos]; i; i = e[i].nxt) {
    int v = e[i].v;
    if (!vis2[v]) dfs2(v, tag);
  }
}
int histo[200050], hc;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    adde(u, v, i);
  }
  for (int i = 1; i <= n; ++i) {
    memset(vis1, 0, sizeof(vis1));
    memset(vis2, 0, sizeof(vis2));
    hc = 0;
    vis1[i] = vis2[i] = -1;
    for (int j = head[i]; j; j = e[j].nxt) {
      int v = e[j].v;
      histo[++hc] = j;
      if (!vis1[v]) dfs1(v, j);
    }
    for (int j = hc; j >= 1; --j) {
      int v = e[histo[j]].v;
      if (!vis2[v]) dfs2(v, histo[j]);
      if (vis1[e[histo[j]].v] != vis2[e[histo[j]].v]) flg2[histo[j]] = 1;
    }
    for (int j = hd[i]; j; j = e2[j].nxt)
      if (vis1[e2[j].v]) flg1[j] = 1;
  }
  for (int i = 1; i <= m; ++i) puts(flg1[i] + flg2[i] == 1 ? "diff" : "same");
}
