#include<bits/stdc++.h>
using namespace std;

int N, M;
int ans[200010];
vector<int> adj[1010], radj[1010], sadj[1010], U, V;
int tin[1010], bck[1010], id[1010], timer, scnt;
stack<int> stk;

void dfs(int u) {
    tin[u] = timer++;
    bck[u] = tin[u];
    stk.push(u);

    for(int i = 0; i < adj[u].size(); i++) {
        int e = adj[u][i];
        int v = V[e];
        if(tin[v] == -1) {
            dfs(v);
            bck[u] = min(bck[u], bck[v]);
        }
        else if(id[v] == -1) {
            bck[u] = min(bck[u], tin[v]);
        }
    }
    if(bck[u] == tin[u]) {
        while(1) {
            int t = stk.top(); stk.pop();
            id[t] = scnt;
            if(t == u) break;
        }
        scnt++;
    }
}

int cc[1010][1010];
int dp(int u, int d) {
    int &ret = cc[u][d];
    if(ret != -1) return ret;
    if(u == d) return ret = 0;

    ret = -1e9;
    for(int i = 0; i < sadj[u].size(); i++) {
        int v = sadj[u][i];
        ret = max(ret, 1 + dp(v, d));
    }
    return ret;
}

int Cnt[1010][1010];

void scc() {
    memset(tin, -1, sizeof(tin));
    memset(id, -1, sizeof(id));
    for(int i = 0; i < N; i++) if(tin[i] == -1) {
        dfs(i);
    }
    for(int e = 0; e < M; e++) {
        int u = U[e];
        int v = V[e];
        if(id[u] != id[v]) {
            sadj[ id[u] ].push_back(id[v]);
            Cnt[ id[u] ][ id[v] ]++;
        }
    }

    memset(cc, -1, sizeof(cc));
    for(int e = 0; e < M; e++) {
        int u = U[e];
        int v = V[e];
        if(id[u] != id[v]) {
            if(Cnt[ id[u] ][ id[v] ] > 1 || dp(id[u], id[v]) > 1) ans[e] = 1;
            else ans[e] = 0;
        }
    }
}

queue<int> q1, q2;
int dist1[1010], dist2[1010], par1[1010], par2[1010];

int main() {
    scanf("%d %d", &N, &M);

    for(int i = 0; i < M; i++) {
        int u, v; scanf("%d %d", &u, &v);
        u--; v--;

        adj[u].push_back(i);
        radj[v].push_back(i);
        U.push_back(u);
        V.push_back(v);
    }

    scc();

    for(int u = 0; u < N; u++) {
        memset(dist1, -1, sizeof(dist1));
        memset(dist2, -1, sizeof(dist2));

        for(int i = 0; i < radj[u].size(); i++) {
            int e = radj[u][i];
            int v = U[e];
            if(id[u] == id[v]) {
                q1.push(v);
                dist1[v] = 0;
                par1[v] = v;
            }
        }
        while(!q1.empty()) {
            int t = q1.front(); q1.pop();

            for(int i = 0; i < radj[t].size(); i++) {
                int e = radj[t][i];
                int v = U[e];
                if(u == v) continue;
                if(id[u] == id[v]) {
                    if(dist1[v] == -1) {
                        dist1[v] = dist1[t] + 1;
                        par1[v] = par1[t];
                        q1.push(v);
                    }
                    else if(dist2[v] == -1 && par1[v] != par1[t]) {
                        dist2[v] = dist1[t] + 1;
                        par2[v] = par1[t];
                        q2.push(v);
                    }
                }
            }
        }
        while(!q2.empty()) {
            int t = q2.front(); q2.pop();

            for(int i = 0; i < radj[t].size(); i++) {
                int e = radj[t][i];
                int v = U[e];
                if(u == v) continue;
                if(id[u] == id[v]) {
                    if(dist2[v] == -1 && par1[v] != par2[t]) {
                        dist2[v] = dist2[t] + 1;
                        par2[v] = par2[t];
                        q2.push(v);
                    }
                }
            }
        }

        for(int i = 0; i < radj[u].size(); i++) {
            int e = radj[u][i];
            int v = U[e];
            if(id[u] == id[v]) {
                if(dist2[v] != -1) ans[e] = 0;
                else ans[e] = 1;
            }
        }
    }

    for(int i = 0; i < M; i++) {
        if(ans[i]) printf("diff\n");
        else printf("same\n");
    }
}


Measured memory_bytes: 15080