#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
vector<pair<int, int> > G[N];
bool mark[N][N], mp[N][N], vis[N];
int ct[N][N];
int rt, n;
void dfs(int u, int type) {
  vis[u] = 1;
  if (mp[rt][u] && !mark[rt][u]) ct[rt][u] |= 1;
  if (!type) {
    for (auto v : G[u])
      if (!vis[v.second])
        mark[u][v.second] = 1, dfs(v.second, type), mark[u][v.second] = 0;
  } else
    for (int i = G[u].size() - 1; i >= 0; i--)
      if (!vis[G[u][i].second])
        mark[u][G[u][i].second] = 1, dfs(G[u][i].second, type),
        mark[u][G[u][i].second] = 0;
}
inline void clr() {
  for (int i = 1; i <= n; i++) vis[i] = 0;
}
inline void solve(int u) {
  rt = u, clr(), dfs(u, 0), clr(), dfs(u, 1);
  for (int i = 1; i <= n; i++)
    if (vis[i]) ct[i][u] |= 2;
}
int ans[N];
int main() {
  int m;
  scanf("%d%d", &n, &m);
  for (int i = 1, a, b; i <= m; i++)
    scanf("%d%d", &a, &b), G[a].push_back(pair<int, int>(i, b)), mp[a][b] = 1;
  for (int i = 1; i <= n; i++) sort(G[i].begin(), G[i].end());
  for (int i = 1; i <= n; i++) solve(i);
  for (int i = 1; i <= n; i++)
    for (auto v : G[i])
      if (ct[i][v.second] != 0 && ct[i][v.second] != 3) ans[v.first] = 1;
  for (int i = 1; i <= m; i++) puts(ans[i] ? "diff" : "same");
}
