#include <bits/stdc++.h>
using namespace std;
const int MC = 1024;
int N, M;
vector<int> V[MC];
vector<pair<int, int> > E;
bool visited[MC];
bool solve(pair<int, int> p, int q, int t) {
  if (q == t) return 1;
  visited[q] = 1;
  for (auto u : V[q]) {
    if (p.first == q && p.second == u || visited[u]) continue;
    if (solve(p, u, t)) return 1;
  }
  return 0;
}
int main() {
  cin >> N >> M;
  for (int i = (int)(0); i < (int)(M); ++i) {
    int a, b;
    cin >> a >> b;
    V[a].push_back(b);
    E.push_back(make_pair((a), (b)));
  }
  for (auto u : E) {
    fill(visited, visited + MC, 0);
    bool b = solve(u, u.second, u.first);
    fill(visited, visited + MC, 0);
    b ^= solve(u, u.first, u.second);
    cout << (b ? "diff" : "same") << endl;
  }
  return 0;
}
