#include <bits/stdc++.h>
#define N 1010
#define M 200200
using namespace std;

int n, m;
vector<int> G[N];

queue<int> q;
void bfs(int s, int mark, int *vis) {
    q.push(s), vis[s] = mark;
    while (!q.empty()) {
        int u = q.front(); q.pop();
        for (int v : G[u]) {
            if (vis[v]) continue;
            vis[v] = mark, q.push(v);
        }
    }
}

int vis[N][N], v1[N], v2[N], vis2[N][N], ans[N], stk[N], top, id[N][N];

int main() {
#ifdef isLOCAL
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif
    
    cin >> n >> m;
    for (int i = 1, u, v; i <= m; ++i)
        scanf("%d%d", &u, &v), id[u][v] = i,
        G[u].push_back(v);

    for (int i = 1; i <= n; ++i)
        bfs(i, 1, vis[i]);

    for (int u = 1; u <= n; ++u) {
        memset(v1, 0, sizeof v1);
        memset(v2, 0, sizeof v2);
        top = 0;
        for (int v : G[u])
            stk[++top] = v; 
        for (int i = 1, v; i <= top; ++i)
            if (!v1[v = stk[i]])
                v1[u] = i, bfs(v, i, v1);
        for (int i = top, v; i >= 1; --i)
            if (!v2[v = stk[i]])
                v2[u] = i, bfs(v, i, v2);
        for (int i = 1, v; i <= top; ++i) {
            v = stk[i];
            if (vis[v][u] == (v1[v] != i || v2[v] != i))
                ans[id[u][v]] = 1;
        }
    }
    
    for (int i = 1; i <= m; ++i)
        puts(ans[i] ? "same" : "diff");

    return 0;
}
