#include <bits/stdc++.h>
using namespace std;
const int sz = 1009;
int n, m;
int rt;
int u, v, cnt;
bool vis[sz];
int head[sz];
bool b[200007];
bool d[sz][sz];
bool ans[sz];
stack<int> s;
struct Edge {
  int v, nxt;
} edge[200007];
void make_edge(int u, int v) {
  edge[++cnt] = (Edge){v, head[u]};
  head[u] = cnt;
}
void dfs(int x, int tp) {
  if (tp) d[rt][x] = 1;
  vis[x] = 1;
  for (int i = head[x]; i; i = edge[i].nxt)
    if (!vis[edge[i].v]) dfs(edge[i].v, tp);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &u, &v);
    make_edge(u, v);
  }
  for (rt = 1; rt <= n; rt++) {
    for (int j = 1; j <= n; j++) vis[j] = 0;
    dfs(rt, 1);
  }
  for (rt = 1; rt <= n; rt++) {
    for (int j = 1; j <= n; j++) vis[j] = 0;
    vis[rt] = 1;
    for (int i = head[rt]; i; i = edge[i].nxt) {
      if (vis[edge[i].v])
        b[i] = 1;
      else
        dfs(edge[i].v, 0);
      s.push(i);
    }
    for (int j = 1; j <= n; j++) vis[j] = 0;
    vis[rt] = 1;
    while (!s.empty()) {
      if (vis[edge[s.top()].v])
        b[s.top()] = 1;
      else
        dfs(edge[s.top()].v, 0);
      s.pop();
    }
  }
  for (rt = 1; rt <= n; rt++)
    for (int i = head[rt]; i; i = edge[i].nxt) ans[i] = d[edge[i].v][rt] ^ b[i];
  for (int i = 1; i <= m; i++)
    if (ans[i])
      puts("diff");
    else
      puts("same");
}
