#include <bits/stdc++.h>
using namespace std;
int mp[1111][1111];
int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<long long, long long> > v;
  for (long long(i) = (0); (i) < (n); ++i)
    for (long long(j) = (0); (j) < (n); ++j) mp[i][j] = 100000000;
  for (long long(i) = (0); (i) < (n); ++i) mp[i][i] = 0;
  for (long long(i) = (0); (i) < (m); ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    v.push_back(make_pair(a, b));
    mp[a][b] = 1;
  }
  for (long long(k) = (0); (k) < (n); ++k)
    for (long long(i) = (0); (i) < (n); ++i)
      for (long long(j) = (0); (j) < (n); ++j) {
        mp[i][j] = min(mp[i][j], mp[i][k] + mp[k][j]);
      }
  for (long long(i) = (0); (i) < (m); ++i) {
    int a = v[i].first;
    int b = v[i].second;
    int ab = 1;
    int ba = 100000000;
    for (long long(j) = (0); (j) < (n); ++j) {
      if (mp[a][j] + mp[j][b] < 100000000 && mp[a][j] != mp[a][b] + mp[b][j] &&
          mp[j][b] != mp[j][a] + mp[a][b])
        ab = max(ab, mp[a][j] + mp[j][b]);
      if ((j == a || j == b) ||
          mp[b][j] != mp[b][a] + mp[a][j] && mp[j][a] != mp[j][b] + mp[b][a])
        ba = min(ba, mp[b][j] + mp[j][a]);
    }
    if ((ab > 1 && ba == 100000000) || (ab == 1 && ba < 100000000)) {
      cout << "diff" << '\n';
    } else {
      cout << "same" << '\n';
    }
  }
  return 0;
}
