#include <bits/stdc++.h>
using namespace std;
const int N = 1005, M = N * N;
vector<int> g[N];
int n, m, ans[M], vis[N], clk;
int a[M], b[M], tim[N], del;
void dfs(int v) {
  vis[v] = clk;
  for (int d : g[v]) {
    if ((!vis[d]) && d != del) dfs(d);
  }
}
void gao(int x) {
  del = x;
  memset(vis, 0, sizeof(vis));
  clk = 0;
  for (int d : g[x]) {
    ++clk;
    tim[d] = clk;
    if (!vis[d]) dfs(d);
  }
  for (int i = 1; i <= (m); ++i)
    if (a[i] == x && vis[b[i]] != tim[b[i]]) ans[i] = 1;
}
int main(int argc, char* argv[]) {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= (m); ++i) {
    scanf("%d%d", a + i, b + i);
    g[a[i]].push_back(b[i]);
  }
  for (int x = 1; x <= (n); ++x) {
    gao(x);
    reverse(g[x].begin(), g[x].end());
    gao(x);
  }
  for (int x = 1; x <= (n); ++x) {
    del = 0;
    memset(vis, 0, sizeof(vis));
    dfs(x);
    for (int i = 1; i <= (m); ++i)
      if (b[i] == x) ans[i] ^= vis[a[i]];
  }
  for (int i = 1; i <= (m); ++i) printf("%s\n", ans[i] ? "diff" : "same");
  return 0;
}
