#include <bits/stdc++.h>
using namespace std;
const int MN = 1010;
const int MM = 100010;
int N, M;
int a[MM], b[MM];
vector<pair<int, int> > g[MN];
bool no_need[MM];
bool vis[MN];
bool can[MN][MN];
void dfs(int v, int st) {
  vis[v] = 1;
  for (auto e : g[v]) {
    if (!vis[e.first] && e.first != st) {
      dfs(e.first, st);
    }
  }
}
int main() {
  scanf("%d%d", &N, &M);
  for (int i = 0; i < (M); i++) {
    scanf("%d%d", &a[i], &b[i]);
    --a[i];
    --b[i];
    g[a[i]].emplace_back(b[i], i);
  }
  for (int i = 0; i < (N); i++) {
    queue<int> que;
    can[i][i] = 1;
    que.push(i);
    while (!que.empty()) {
      int v = que.front();
      que.pop();
      for (auto e : g[v]) {
        if (!can[i][e.first]) {
          can[i][e.first] = 1;
          que.push(e.first);
        }
      }
    }
  }
  for (int i = 0; i < (N); i++) {
    for (int t = 0; t < (2); t++) {
      memset(vis, 0, sizeof(vis));
      for (auto e : g[i]) {
        if (vis[e.first]) {
          no_need[e.second] = true;
        } else {
          dfs(e.first, i);
        }
      }
      reverse((g[i]).begin(), (g[i]).end());
    }
  }
  for (int i = 0; i < (M); i++) {
    puts(no_need[i] == can[b[i]][a[i]] ? "same" : "diff");
  }
  return 0;
}
