#include <stdio.h>
#include <vector>
using namespace std;
#define N (1010)
#define M (200010)
#define PB push_back
int n, m;
int v[N][N];
int src, cv;
int vst[N], a[M], b[M], suc[N], cnt[N];
int f[N][N], g[N][N];
void dfs(int x){
    vst[x] = cv;
    for (int i = 0, y; i < cnt[x]; ++i){
        y = v[x][i];
        if (cv != vst[y]){
            if (suc[y]) f[src][y] = 1;
            dfs(y);
        }
    }
}
void dfs2(int x){
    vst[x] = cv;
    for (int i = 0, y; i < cnt[x]; ++i){
        y = v[x][i];
        if (vst[y] != cv){
            dfs2(y);
        }
    }
}
int main(){
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; ++i) {
        scanf("%d%d", a+i, b+i);
        v[a[i]][cnt[a[i]]++] = b[i];
    }
    for (int i = 1; i <= n; ++i){
        src = i;
        for (int j = 1; j <= n; ++j){
            suc[j] = 0;
        }
        for (int j = 0; j < cnt[i]; ++j){
            suc[v[i][j]] = 1;
        }
        vst[i] = ++cv;
        for (int j = 0; j < cnt[i]; ++j){
            dfs(v[i][j]);
        }
        vst[i] = ++cv;
        for (int j = cnt[i]-1; ~j; --j){
            dfs(v[i][j]);
        }
        cv++;
        dfs2(i);
        for (int j = 1; j <= n; ++j){
            g[i][j] = vst[j] == cv;
        }
    }
    for (int i  =1; i <= m; ++i){
        // printf("%d %d\n", f[a[i]][b[i]], g[b[i]][a[i]]);
        printf("%s\n", !(f[a[i]][b[i]] ^ g[b[i]][a[i]]) ? "same" : "diff");
    }
}