#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1000, N = 1000, MAXM = 2e5;
vector<long long> g[MAXN], gt[MAXN];
long long a[MAXN], b[MAXN], c1[MAXN], c2[MAXN];
vector<long long> topsort;
long long vis[MAXN];
pair<long long, long long> ed[MAXM];
bool used[N];
void dfs(long long first) {
  used[first] = 1;
  for (long long e : g[first]) {
    long long second = ed[e].first ^ ed[e].second ^ first;
    if (!used[second]) dfs(second);
  }
}
void solve(long long first) {
  memset(used, 0, sizeof used);
  for (long long e : g[first]) {
    long long second = ed[e].first ^ ed[e].second ^ first;
    if (used[second]) {
      c2[e] = 1;
    } else {
      dfs(second);
    }
  }
  memset(used, 0, sizeof used);
  reverse(g[first].begin(), g[first].end());
  for (long long e : g[first]) {
    long long second = ed[e].first ^ ed[e].second ^ first;
    if (used[second]) {
      c2[e] = 1;
    } else {
      dfs(second);
    }
  }
}
void dfst1(long long second) {
  vis[second] = 1;
  for (long long e : g[second]) {
    long long first = b[e];
    if (!vis[first]) dfst1(first);
  }
  topsort.push_back(second);
}
long long clr = 0;
void dfst2(long long second) {
  vis[second] = clr;
  for (long long e : gt[second]) {
    long long first = a[e];
    if (!vis[first]) dfst2(first);
  }
}
void solve() {
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < m; ++i) {
    cin >> a[i] >> b[i];
    --a[i];
    --b[i];
    g[a[i]].push_back(i);
    gt[b[i]].push_back(i);
  }
  for (long long i = 0; i < n; ++i)
    if (!vis[i]) dfst1(i);
  fill(vis, vis + n, 0);
  reverse(topsort.begin(), topsort.end());
  for (long long second : topsort)
    if (!vis[second]) {
      ++clr;
      dfst2(second);
    }
  for (long long i = 0; i < m; ++i) c1[i] = (vis[a[i]] == vis[b[i]]);
  for (long long i = 0; i < m; ++i) {
    ed[i] = {a[i], b[i]};
  }
  for (long long i = 0; i < n; ++i) {
    solve(i);
  }
  for (long long i = 0; i < m; ++i) {
    if (c1[i] ^ c2[i]) {
      cout << "diff\n";
    } else {
      cout << "same\n";
    }
  }
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
