#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
vector<pair<int, int> > G[N];
bool vis[N];
int ct[N][N], wkr[N];
int rt, n, col;
void dfs(int u, int type) {
  if (!type)
    wkr[u] = col;
  else if (wkr[u] != col)
    ct[rt][u] |= 1;
  vis[u] = 1;
  for (auto v : G[u])
    if (!vis[v.second]) dfs(v.second, type);
}
inline void clr() {
  for (int i = 1; i <= n; i++) vis[i] = 0;
}
inline void solve(int u) {
  rt = u, clr(), vis[u] = 1;
  for (auto v : G[u])
    if (!vis[v.second]) dfs(col = v.second, 0);
  clr(), vis[u] = 1;
  for (int i = (int)G[u].size() - 1; i >= 0; i--)
    if (!vis[G[u][i].second]) dfs(col = G[u][i].second, 1);
  for (int i = 1; i <= n; i++)
    if (vis[i]) ct[i][u] |= 2;
}
int ans[N * 20];
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));
  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");
}
