#include <bits/stdc++.h>
using namespace std;
int f[1010][1010][2], vis[1010 << 1], T;
struct node {
  int to, id;
};
vector<node> edge[1010];
pair<int, int> E[200010];
void dfs(int u, int src, int id, int type) {
  f[src][u][type] = id;
  vis[u] = T;
  for (auto& e : edge[u]) {
    int v = e.to;
    if (vis[v] != T) dfs(v, src, id, type);
  }
}
void work(int src) {
  ++T;
  vis[src] = T;
  for (auto& e : edge[src]) {
    int v = e.to;
    if (vis[v] != T) dfs(v, src, e.id, 0);
  }
  reverse(edge[src].begin(), edge[src].end());
  ++T;
  vis[src] = T;
  for (auto& e : edge[src]) {
    int v = e.to;
    if (vis[v] != T) dfs(v, src, e.id, 1);
  }
}
int main() {
  int n, m, u, v;
  scanf("%d%d", &n, &m);
  for (int i = (1); i <= (m); ++i) {
    scanf("%d%d", &u, &v);
    edge[u].push_back({v, i});
    E[i] = {u, v};
  }
  for (int i = (1); i <= (n); ++i) work(i);
  for (int i = (1); i <= (m); ++i) {
    int u = E[i].first, v = E[i].second;
    if (f[v][u] != 0 ^ (f[u][v][0] != i || f[u][v][1] != i))
      puts("diff");
    else
      puts("same");
  }
  return 0;
}
