#include <bits/stdc++.h>

using namespace std; 

int n, m, col[1005]; 
bool can[1005][1005], only[1005][1005]; 
int vis[1005]; 
vector <int> G[1010]; 

void dfs1(int u, int x) {
    can[x][u] = 1; 
    vis[u] = 1; 
    for (auto v : G[u]) {
        if (!vis[v]) {
            dfs1(v, x);
        }
    }
}

void dfs2(int u, int x, int t, int op) {
    // cout << u << '\n'; 
    if (op == 1) {
        only[x][u] = col[u] != t; 
    }
    else {
        col[u] = t; 
    }
    vis[u] = 1; 
    for (auto v : G[u]) {
        if (!vis[v]) {
            dfs2(v, x, t, op); 
        }
    }
}

int U[1010100], V[1010100]; 

int main() {
    scanf("%d %d", &n, &m); 
    for (int i = 1; i <= m; i++) {
        int u, v; 
        scanf("%d %d", &u, &v);
        U[i] = u, V[i] = v; 
        G[u].push_back(v);  
    }
    for (int i = 1; i <= n; i++) {
        memset(vis, 0, sizeof(vis)); 
        vis[i] = 1; 
        dfs1(i, i); 
    }
    for (int i = 1; i <= n; i++) {
        memset(vis, 0, sizeof(vis)); 
        vis[i] = 1;
        memset(col, 0, sizeof(col));  
        for (int j = 0; j < G[i].size(); j++) {
            int v = G[i][j]; 
            if (!vis[v])
                dfs2(v, i, j + 1, 0); 
        }
        memset(vis, 0, sizeof(vis)); 
        vis[i] = 1; 
        for (int j = G[i].size() - 1; j >= 0; j--) {
            int v = G[i][j]; 
            if (!vis[v])
                dfs2(v, i, j + 1, 1); 
        }
    }
    for (int i = 1; i <= m; i++) {
        if (can[V[i]][U[i]] ^ only[U[i]][V[i]]) puts("diff"); 
        else puts("same"); 
    }
    return 0; 
}