#include <bits/stdc++.h>
using namespace std;
const int N = 1005, M = 2e5 + 10;
int n, m, u[M], v[M], ok[N][N], pos[N][N], vis[N][N], ok2[N][N];
vector<int> g[N];
void dfs(int h, int u) {
    ok[u][h] = 1;
    for(auto v : g[u]) if(!ok[v][h]) dfs(h, v);
}
void dfs1(int h, int u, int fr) {
    pos[h][u] = fr;
    for(auto v : g[u])
        if(!pos[h][v]) dfs1(h, v, u);
}
void dfs2(int h, int u) {
    vis[h][u] = 1;
    for(int i = g[u].size() - 1; i >= 0; --i) {
        int v = g[u][i];
        if(!vis[h][v]) {
            if(pos[h][v] != u || u != h) ok2[h][v] = 1;
            dfs2(h, v);
        }
    }
}
int main() {
    scanf("%d %d", &n, &m);
    for(int i = 1; i <= m; ++i) 
        scanf("%d %d", &u[i], &v[i]), g[u[i]].push_back(v[i]);
    for(int i = 1; i <= n; ++i) dfs(i, i);
    for(int i = 1; i <= n; ++i) dfs1(i, i, i);
    for(int i = 1; i <= n; ++i) dfs2(i, i);
    for(int i = 1; i <= m; ++i) {
        if(ok[u[i]][v[i]] ^ ok2[u[i]][v[i]]) printf("diff\n");
        else printf("same\n");
    }
    return 0;
}
