#include <bits/stdc++.h>
using namespace std;
class UnionFind {
 public:
  UnionFind(int);
  int find(int);
  void unite(int, int);

 private:
  vector<int> table;
};
UnionFind::UnionFind(int size) {
  table.resize(size);
  fill(table.begin(), table.end(), -1);
}
int UnionFind::find(int x) {
  while (0 <= table[x]) x = table[x];
  return x;
}
void UnionFind::unite(int x, int y) {
  int rx = find(x);
  int ry = find(y);
  if (rx != ry) {
    int dx = -table[rx];
    int dy = -table[ry];
    if (dx != dy) {
      if (dx < dy) {
        table[rx] = ry;
      } else {
        table[ry] = rx;
      }
    } else {
      table[rx] -= 1;
      table[ry] = rx;
    }
  }
}
vector<vector<int> > e, re;
UnionFind cc(1024);
UnionFind scc(1024);
int post[1024];
int rev[1024];
bool visited[1024];
bool visited2[1024];
int t = 1;
void dfs0(int u, int r) {
  cc.unite(u, r);
  post[u] = 1;
  for (int w : e[u]) {
    if (!post[w]) {
      dfs0(w, r);
    }
  }
  post[u] = t;
  rev[t] = u;
  ++t;
}
void dfs1(int u, int r, int cr, bool visited[]) {
  scc.unite(u, r);
  visited[u] = true;
  for (int w : re[u]) {
    if (cc.find(w) != cr) {
      continue;
    }
    if (!visited[w]) {
      dfs1(w, r, cr, visited);
    }
  }
}
void dfs2(int u, int r, int first, unordered_set<int>& rs, bool visited[]) {
  visited[u] = true;
  for (int w : e[u]) {
    if (!visited[w]) {
      dfs2(w, r, first, rs, visited);
    } else if (w != r && w != first) {
      rs.insert((((r) << 10) | (w)));
    }
  }
}
void traverse(int n, int s, unordered_set<int>& rs) {
  fill(visited2, visited2 + n + 1, false);
  visited2[s] = true;
  for (int w : e[s]) {
    visited2[w] = true;
  }
  for (int w : e[s]) {
    dfs2(w, s, w, rs, visited2);
  }
}
void solve(int n, int m, vector<pair<int, int> >& edges) {
  int cur;
  int r1, cr;
  fill(post, post + n + 1, 0);
  fill(rev, rev + n + 1, 0);
  fill(visited, visited + n + 1, false);
  for (int(r) = (1); (r) < (n + 1); ++(r)) {
    if (!post[r]) {
      cur = t;
      dfs0(r, r);
      cr = cc.find(r);
      for (int v = t - 1; v >= cur; --v) {
        r1 = rev[v];
        if (!visited[r1]) {
          dfs1(r1, r1, cr, visited);
        }
      }
    }
  }
  unordered_set<int> path_exists;
  int a, b;
  int scc_a, scc_b;
  bool exist;
  fill(visited, visited + n + 1, false);
  for (pair<int, int> p : edges) {
    tie(a, b) = p;
    if (!visited[a]) {
      visited[a] = true;
      traverse(n, a, path_exists);
    }
  }
  for (pair<int, int> p : edges) {
    tie(a, b) = p;
    scc_a = scc.find(a);
    scc_b = scc.find(b);
    exist = (path_exists.find((((a) << 10) | (b))) != path_exists.end());
    cout << (((scc_a == scc_b) != exist) ? "diff" : "same") << endl;
  }
}
int main(int argc, const char* argv[]) {
  int n, m;
  int a, b;
  vector<pair<int, int> > edges;
  cin >> n >> m;
  e.resize(n + 1);
  re.resize(n + 1);
  for (int(i) = (0); (i) < (m); ++(i)) {
    cin >> a >> b;
    edges.push_back(make_pair(a, b));
    e[a].push_back(b);
    re[b].push_back(a);
  }
  solve(n, m, edges);
  return 0;
}
