#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<long long> g[1010];
vector<pair<long long, long long> > es;
long long cnt[1010][1010];
bool vis[1010];
void dfs(long long v, long long st) {
  vis[v] = true;
  cnt[st][v]++;
  for (long long nv : g[v]) {
    if (vis[nv] || nv == st) continue;
    dfs(nv, st);
  }
}
int main() {
  cin >> n >> m;
  for (long long i = (long long)(0); i < (long long)(m); i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    es.push_back(pair<long long, long long>(a, b));
  }
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    for (long long v : g[i]) {
      memset(vis, 0, sizeof(vis));
      dfs(v, i);
    }
  }
  for (long long i = (long long)(0); i < (long long)(m); i++) {
    long long a = cnt[es[i].first][es[i].second];
    long long b = cnt[es[i].second][es[i].first];
    if ((a >= 2 && b >= 1) || (a < 2 && b < 1))
      cout << "same" << endl;
    else
      cout << "diff" << endl;
  }
  return 0;
}
