#include <bits/stdc++.h>
using namespace std;
struct edge {
  int v, nxt;
} e[400050];
int head[1050], ecnt;
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;
}
vector<pair<int, int> > come[1050];
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);
    come[v].push_back(make_pair(u, 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 (auto v : come[i])
      if (vis1[v.first]) flg1[v.second] = 1;
  }
  for (int i = 1; i <= m; ++i)
    printf("%s\n", flg1[i] + flg2[i] == 1 ? "diff" : "same");
}
