#include <bits/stdc++.h>
using namespace std;
bool dfs_condition_1(vector<vector<pair<int, int> > > g, vector<bool> &check,
                     int now, int dest) {
  if (now == dest) return true;
  check[now - 1] = true;
  for (int i = (0); i < (g[now - 1].size()); ++i) {
    if (!check[g[now - 1][i].second - 1]) {
      if (dfs_condition_1(g, check, g[now - 1][i].second, dest)) return true;
    }
  }
  return false;
}
void dfs_condition_2(vector<vector<pair<int, int> > > g, vector<int> &check,
                     int num, int now, int a) {
  if (check[now - 1] == -1) check[now - 1] = num;
  for (int i = (0); i < (g[now - 1].size()); ++i) {
    if (g[now - 1][i].second != a && check[g[now - 1][i].second - 1] == -1)
      dfs_condition_2(g, check, num, g[now - 1][i].second, a);
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<pair<int, int>, int> > e(m);
  for (int i = (0); i < (m); ++i) {
    int a, b;
    cin >> a;
    cin >> b;
    e[i] = make_pair(make_pair(a, b), i);
  }
  vector<vector<pair<int, int> > > g(n);
  sort((e).begin(), (e).end());
  int j = 0;
  for (int i = (0); i < (n); ++i) {
    while (j < m && e[j].first.first == i + 1) {
      g[i].push_back(e[j].first);
      j++;
    }
  }
  vector<bool> cf(m), cs(m);
  for (int i = (0); i < (m); ++i) {
    vector<bool> check(n);
    cf[e[i].second] =
        dfs_condition_1(g, check, e[i].first.second, e[i].first.first);
  }
  for (int i = (0); i < (n); ++i) {
    vector<int> cmax(n), cmin(n);
    for (int k = (0); k < (n); ++k) {
      cmax[k] = -1;
      cmin[k] = -1;
    }
    for (int k = (0); k < (g[i].size()); ++k) {
      dfs_condition_2(g, cmin, k, g[i][k].second, i + 1);
    }
    for (int k = (0); k < (g[i].size()); ++k) {
      dfs_condition_2(g, cmax, g[i].size() - k - 1,
                      g[i][g[i].size() - k - 1].second, i + 1);
    }
    pair<pair<int, int>, int> pp = make_pair(make_pair(i + 1, 0), 0);
    vector<pair<pair<int, int>, int> >::iterator itr =
        lower_bound(e.begin(), e.end(), pp);
    for (int k = (0); k < (g[i].size()); ++k) {
      if (cmax[g[i][k].second - 1] == k && cmin[g[i][k].second - 1] == k)
        cs[(*itr++).second] = true;
    }
  }
  for (int i = (0); i < (m); ++i) {
    if ((cf[i] || cs[i]) && !(cf[i] && cs[i]))
      cout << "same" << endl;
    else
      cout << "diff" << endl;
  }
  return 0;
}
