#include <bits/stdc++.h>
using namespace std;
struct edge {
    int u, v;
} e[200010];
vector <int> to[1010];
int tag1[1010][1010], tag2[1010][1010];
int n, m;
int vis[1010];
inline void dfs(int now) {
    if(vis[now]) return;
    vis[now] = 1;
    for (auto v : to[now]) dfs(v);
}
int main() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; i++) scanf("%d%d", &e[i].u, &e[i].v), to[e[i].u].push_back(e[i].v);
    for (int i = 1; i <= n; i++) {
        memset(vis, 0, sizeof vis);
        vis[i] = 1;
        for (auto v : to[i]) tag2[i][v] |= vis[v], dfs(v);
        reverse(to[i].begin(), to[i].end());
        memset(vis, 0, sizeof vis);
        vis[i] = 1;
        for (auto v : to[i]) tag2[i][v] |= vis[v], dfs(v);
        memcpy(tag1[i], vis, sizeof tag1[i]);
    }
    for (int i = 1; i <= m; i++) puts(tag1[e[i].v][e[i].u] ^ tag2[e[i].u][e[i].v] ? "diff" : "same");
    return 0;
}