#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16000000")
using namespace std;
const int Maxn = 1005;
const int Maxm = 200005;
int n, m;
int a[Maxm], b[Maxm];
vector<pair<int, int> > neigh[Maxn];
int cur, tim[Maxn], low[Maxn];
int imp[Maxm];
int my[Maxn];
vector<int> S;
bool onStack[Maxn];
int curcol, col[Maxn];
int res[Maxm];
vector<pair<int, int> > gneigh[Maxn];
int imp2[Maxm];
int par[Maxn], siz[Maxn];
vector<int> sneigh[Maxn];
bool vis[Maxn];
int Connect(int v) {
  int res = 0;
  cur++;
  tim[v] = low[v] = cur;
  my[v] = -1;
  S.push_back(v);
  onStack[v] = true;
  for (int i = 0; i < neigh[v].size(); i++) {
    pair<int, int> u = neigh[v][i];
    if (!tim[u.first]) {
      imp[u.second] |= 2;
      res += Connect(u.first);
      low[v] = min(low[v], low[u.first]);
    } else if (onStack[u.first] && tim[u.first] < low[v]) {
      if (my[v] != -1) imp[my[v]] ^= 1;
      low[v] = tim[u.first];
      imp[u.second] ^= 1;
      my[v] = u.second;
    }
  }
  if (tim[v] == low[v]) {
    res++;
    curcol++;
    int w;
    do {
      w = S.back();
      S.pop_back();
      col[w] = curcol;
      onStack[w] = false;
    } while (w != v);
  }
  return res;
}
int Count(int v, int forb) {
  int res = 0;
  cur++;
  tim[v] = low[v] = cur;
  S.push_back(v);
  onStack[v] = true;
  if (v == b[forb]) {
    int u = a[forb];
    if (!tim[u]) {
      res += Count(u, forb);
      low[v] = min(low[v], low[u]);
    } else if (onStack[u] && tim[u] < low[v])
      low[v] = tim[u];
  }
  for (int i = 0; i < neigh[v].size(); i++) {
    pair<int, int> u = neigh[v][i];
    if (u.second == forb) continue;
    if (!tim[u.first]) {
      res += Count(u.first, forb);
      low[v] = min(low[v], low[u.first]);
    } else if (onStack[u.first] && tim[u.first] < low[v])
      low[v] = tim[u.first];
  }
  if (tim[v] == low[v]) {
    res++;
    int w;
    do {
      w = S.back();
      S.pop_back();
      onStack[w] = false;
    } while (w != v);
  }
  return res;
}
int Count(int forb) {
  int ans = 0;
  cur = 0;
  fill(tim, tim + Maxn, 0);
  fill(low, low + Maxn, 0);
  for (int i = 1; i <= n; i++)
    if (!tim[i]) ans += Count(i, forb);
  return ans;
}
int getPar(int x) { return par[x] == x ? x : par[x] = getPar(par[x]); }
bool unionSet(int a, int b) {
  a = getPar(a), b = getPar(b);
  if (a == b) return false;
  if (siz[a] < siz[b]) swap(a, b);
  siz[a] += siz[b];
  par[b] = a;
}
void Fill(int v) {
  if (vis[v]) return;
  vis[v] = true;
  for (int i = 0; i < sneigh[v].size(); i++) Fill(sneigh[v][i]);
}
bool Check(int a, int b) {
  fill(vis, vis + Maxn, false);
  Fill(a);
  return vis[b];
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &a[i], &b[i]);
    neigh[a[i]].push_back(pair<int, int>(b[i], i));
  }
  int comp = 0;
  for (int i = 1; i <= n; i++)
    if (!tim[i]) comp += Connect(i);
  for (int i = 1; i <= n; i++) par[i] = i, siz[i] = 1;
  for (int i = 1; i <= m; i++)
    if (col[a[i]] != col[b[i]]) {
      gneigh[col[a[i]]].push_back(pair<int, int>(col[b[i]], i));
      if (unionSet(col[a[i]], col[b[i]])) {
        sneigh[col[a[i]]].push_back(col[b[i]]);
        imp2[i] = true;
      }
      if (imp[i]) res[i] = Count(i) != comp;
    } else if (imp[i])
      res[i] = Count(i) != comp;
  for (int i = 1; i <= m; i++) {
    if (!imp[i] && col[a[i]] != col[b[i]])
      if (imp2[i])
        res[i] = Count(i) != comp;
      else
        res[i] = Check(col[a[i]], col[b[i]]);
    printf("%s\n", res[i] ? "diff" : "same");
  }
  return 0;
}
