#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007ll;
const double EPS = 1e-11;
int n, m;
pair<int, int> edges[252521];
int ids[252521];
const int B = 1000;
struct SCC {
  int n;
  vector<vector<int> > g;
  vector<int> num;
  vector<int> low;
  stack<int> S;
  vector<bool> inS;
  int time;
  vector<vector<int> > scc;
  int count;
  bool construct;
  vector<int> rev;
  SCC(int n) : n(n) { g.resize(n); }
  void add_edge(int a, int b) { g[a].push_back(b); }
  void add_edge(pair<int, int> complex<double>) {
    add_edge(complex<double>.first, complex<double>.second);
  }
  void visit(int v) {
    low[v] = num[v] = ++time;
    S.push(v);
    inS[v] = true;
    for (int e = 0; e < (int)(g[v].size()); ++e) {
      int w = g[v][e];
      if (num[w] == 0) {
        visit(w);
        low[v] = min(low[v], low[w]);
      } else if (inS[w]) {
        low[v] = min(low[v], num[w]);
      }
    }
    if (low[v] == num[v]) {
      if (construct) scc.push_back(vector<int>());
      count++;
      while (true) {
        int w = S.top();
        S.pop();
        inS[w] = false;
        if (construct) {
          scc.back().push_back(w);
          rev[w] = scc.size() - 1;
        }
        if (v == w) break;
      }
    }
  }
  int calc(bool _const) {
    num.assign(n, 0);
    low.assign(n, 0);
    inS.assign(n, false);
    time = 0;
    count = 0;
    construct = _const;
    if (construct) {
      rev.assign(n, 0);
    }
    for (int u = 0; u < (int)(n); ++u)
      if (num[u] == 0) {
        visit(u);
      }
    return count;
  }
};
bool ans[252521];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (int)(m); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a;
    --b;
    edges[i] = pair<int, int>(a, b);
  }
  int num = 0;
  {
    SCC scc(n);
    for (int i = 0; i < (int)(m); ++i) scc.add_edge(edges[i]);
    num = scc.calc(false);
  }
  for (int i = 0; i < (int)(m); ++i) ids[i] = i;
  srand(83025);
  random_shuffle(ids, ids + m);
  for (int tims = 0; tims < (int)((m + B - 1) / B); ++tims) {
    int beg = B * tims, end = min(B * (tims + 1), m);
    SCC scc(n);
    for (int i = 0; i < (int)(m); ++i)
      if (i < beg || end <= i) {
        scc.add_edge(edges[ids[i]]);
      }
    scc.calc(true);
    unordered_set<long long> e2;
    for (int i = 0; i < (int)(m); ++i)
      if (i < beg || end <= i)
        e2.insert(((((long long)(scc.rev[edges[i].first])) << 32) +
                   (scc.rev[edges[i].second])));
    for (int i = (int)(beg); i < (int)(end); ++i) {
      SCC scc2(scc.count);
      for (long long complex<double> : e2) {
        scc2.add_edge((complex<double> >> 32), complex<double> & 4294967295);
      }
      for (int j = (int)(beg); j < (int)(end); ++j) {
        if (i == j) {
          scc2.add_edge(scc.rev[edges[ids[j]].second],
                        scc.rev[edges[ids[j]].first]);
        } else {
          scc2.add_edge(scc.rev[edges[ids[j]].first],
                        scc.rev[edges[ids[j]].second]);
        }
      }
      int num2 = scc2.calc(false);
      ans[ids[i]] = num == num2;
    }
  }
  for (int i = 0; i < (int)(m); ++i) puts(ans[i] ? "same" : "diff");
  return 0;
}
