#include <bits/stdc++.h>
using namespace std;
void File() {
  freopen("ARC92F.in", "r", stdin);
  freopen("ARC92F.out", "w", stdout);
}
const int maxn = 1000 + 10;
const int maxm = 200000 + 10;
vector<int> E[maxn];
int n, m, beg[maxn], len, num[maxn][maxn];
bool can[maxn][maxn], vis[maxn], can1[maxn][maxn];
int vis1[maxn], vis2[maxn], from[maxm], to[maxm];
void dfs(int u, int rt) {
  vis[u] = 1;
  can[rt][u] = 1;
  int size = E[u].size() - 1;
  for (register int i = 0; i <= size; ++i) {
    int v = E[u][i];
    if (vis[v]) continue;
    dfs(v, rt);
  }
}
void dfs1(int u) {
  vis[u] = 1;
  int size = E[u].size() - 1;
  for (register int i = 0; i <= size; ++i) {
    int v = E[u][i];
    if (vis[v]) continue;
    vis1[v] = num[u][v];
    dfs1(v);
  }
}
void dfs2(int u) {
  vis[u] = 1;
  int size = E[u].size() - 1;
  for (register int i = size; i >= 0; --i) {
    int v = E[u][i];
    if (vis[v]) continue;
    vis2[v] = num[u][v];
    dfs2(v);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (register int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    E[u].push_back(v);
    num[u][v] = ++len;
    from[len] = u;
    to[len] = v;
  }
  for (register int i = 1; i <= n; ++i) {
    dfs(i, i);
    memset(vis, 0, sizeof(vis));
  }
  for (register int i = 1; i <= n; ++i) {
    dfs1(i);
    memset(vis, 0, sizeof(vis));
    dfs2(i);
    memset(vis, 0, sizeof(vis));
    int size = E[i].size() - 1;
    for (register int j = 0; j <= size; ++j) {
      int v = E[i][j];
      if (vis1[v] != num[i][v] || vis2[v] != num[i][v]) can1[i][v] = 1;
    }
    memset(vis1, 0, sizeof(vis1));
    memset(vis2, 0, sizeof(vis2));
  }
  for (register int i = 1; i <= m; ++i) {
    int u = from[i], v = to[i];
    if ((can[v][u] ^ can1[u][v]) == 0)
      puts("same");
    else
      puts("diff");
  }
  return 0;
}
