#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const int M = 200005;
const int INF = 1e9;
int n, m;
int fr[M], to[M];
vector<int> g[N];
int low[N], num[N], step, scc;
stack<int> st;
int pos[N];
bool vis[N];
vector<int> buf;
void dfs(int u) {
  low[u] = num[u] = ++step;
  st.push(u);
  for (int &v : g[u]) {
    if (num[v])
      low[u] = min(low[u], num[v]);
    else {
      dfs(v);
      low[u] = min(low[u], low[v]);
    }
  }
  if (low[u] == num[u]) {
    int v = 0;
    ++scc;
    do {
      v = st.top();
      st.pop();
      low[v] = num[v] = INF;
      pos[v] = scc;
    } while (v != u);
  }
}
bool check(int id) {
  int s = fr[id], t = to[id];
  queue<int> q;
  for (int i = 1; i <= n; ++i) vis[i] = false;
  q.push(s);
  vis[s] = true;
  vector<int> buf;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    buf.push_back(u);
    if (u == t) return true;
    for (int &v : g[u]) {
      if (u == s && v == t) continue;
      if (!vis[v]) {
        vis[v] = true;
        q.push(v);
      }
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    fr[i] = u;
    to[i] = v;
  }
  for (int i = 1; i <= n; ++i)
    if (!num[i]) dfs(i);
  for (int i = 0; i < m; ++i) {
    int u = fr[i], v = to[i];
    bool cur = (pos[u] != pos[v]);
    cur ^= check(i);
    if (cur) {
      printf("same\n");
    } else {
      printf("diff\n");
    }
  }
}
