#include <bits/stdc++.h>
using namespace std;
const int N = 1005, M = 2e5 + 5;
int n, m, x, y;
int d[N];
vector<pair<int, int> > e[N];
vector<int> e2[N];
bool can[M], bz[N], bz2[N];
void cover(int x) {
  if (bz2[x]) return;
  bz2[x] = 1;
  d[1] = x;
  for (int l = 0, r = 1; x = d[++l], l <= r;)
    for (pair<int, int> i : e[x])
      if (!bz2[i.first]) bz2[i.first] = 1, d[++r] = i.first;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1, _e = m; i <= _e; ++i) {
    cin >> x >> y;
    e[x].push_back(pair<int, int>(y, i));
    e2[y].push_back(x);
  }
  for (int i = 1, _e = n; i <= _e; ++i) {
    for (int j = 1, _e = n; j <= _e; ++j) bz2[j] = bz[j] = 0;
    d[1] = i;
    bz[i] = 1;
    for (int l = 0, r = 1; x = d[++l], l <= r;)
      for (int i : e2[x])
        if (!bz[i]) bz[i] = 1, d[++r] = i;
    bz2[i] = 1;
    for (pair<int, int> j : e[i]) {
      can[j.second] = bz2[j.first];
      cover(j.first);
    }
    for (int j = 1, _e = n; j <= _e; ++j) bz2[j] = 0;
    for (int j = e[i].size() - 1, _e = 0; j >= _e; --j) {
      x = e[i][j].first;
      y = e[i][j].second;
      can[y] |= bz2[x];
      cover(x);
      can[y] = can[y] ? (bz[x] ? 0 : 1) : (bz[x] ? 1 : 0);
    }
  }
  for (int i = 1, _e = m; i <= _e; ++i) printf(can[i] ? "diff\n" : "same\n");
}
