#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int n, m, a[N], b[N], used[N];
int comp[N], sz;
vector<int> g[N], rg[N], vec;
vector<pair<int, int> > c;
map<pair<int, int>, int> mp;
void dfs(int v) {
  used[v] = 1;
  for (int to : g[v]) {
    if (!used[to]) dfs(to);
  }
  vec.push_back(v);
}
void Dfs(int v) {
  comp[v] = sz;
  used[v] = 0;
  for (int to : rg[v]) {
    if (used[to]) Dfs(to);
  }
}
void vis(int v) {
  used[v] = 1;
  for (int to : g[v])
    if (!used[to]) vis(to);
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> a[i] >> b[i];
    g[a[i]].push_back(b[i]);
    rg[b[i]].push_back(a[i]);
    c.push_back(make_pair(a[i], b[i]));
  }
  for (int i = 1; i <= n; i++)
    if (!used[i]) dfs(i);
  reverse(vec.begin(), vec.end());
  for (int v : vec)
    if (used[v]) sz++, Dfs(v);
  for (int v = 1; v <= n; v++) {
    memset(used, 0, sizeof(used));
    used[v] = 1;
    for (int to : g[v]) {
      if (used[to]) {
        mp[make_pair(v, to)] = 1;
      }
      vis(to);
    }
    memset(used, 0, sizeof(used));
    used[v] = 1;
    reverse(g[v].begin(), g[v].end());
    for (int to : g[v]) {
      if (used[to]) {
        mp[make_pair(v, to)] = 1;
      }
      vis(to);
    }
  }
  for (auto i : c) {
    if (comp[i.first] != comp[i.second]) mp[i] = 1 - mp[i];
    if (mp[i]) {
      puts("same");
    } else {
      puts("diff");
    }
  }
}
