#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const long long INF = 1LL << 29;
const long long mod = 1e9 + 7;
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  int n = v.size();
  for (long long(i) = 0; (i) < (long long)(n); ++(i))
    os << v[i] << (i == n - 1 ? "" : " ");
  return os;
}
int h[1010][1010];
vector<int> g[1010];
long long a[200100], b[200100];
int f[1010][1010];
long long n, m, vv = -1;
void dfs(int w, int u, int d) {
  if (f[w][u] >= 2) return;
  ((f[w][u]) = max((f[w][u]), (d)));
  for (auto &&v : g[u]) {
    if (v == w) continue;
    if (u == w) vv = v;
    if (f[w][v] == -1)
      dfs(w, v, d + 1);
    else if (f[w][v] == 1 && vv != v)
      f[w][v] = d + 1;
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  ;
  cin >> n >> m;
  for (long long(i) = 0; (i) < (long long)(n); ++(i)) fill(h[i], h[i] + n, INF);
  for (long long(i) = 0; (i) < (long long)(n); ++(i)) h[i][i] = 0;
  for (long long(i) = 0; (i) < (long long)(m); ++(i)) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    g[a[i]].push_back(b[i]);
    h[a[i]][b[i]] = 1;
  }
  for (long long(k) = 0; (k) < (long long)(n); ++(k))
    for (long long(i) = 0; (i) < (long long)(n); ++(i))
      for (long long(j) = 0; (j) < (long long)(n); ++(j))
        ((h[i][j]) = min((h[i][j]), (h[i][k] + h[k][j])));
  memset((f), (-1), sizeof(f));
  for (long long(i) = 0; (i) < (long long)(n); ++(i)) {
    dfs(i, i, 0);
  }
  for (long long(i) = 0; (i) < (long long)(m); ++(i)) {
    bool f2 = h[b[i]][a[i]] != INF;
    bool f1 = f[a[i]][b[i]] >= 2;
    cout << (f1 ^ f2 ? "diff" : "same") << endl;
  }
  return 0;
}
