#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e3 + 10, MAX_M = 2e5 + 10;

struct Edge {
    int v, id;
    Edge() {}
    Edge(int v, int id) : v(v), id(id) {}
};

int N, M, nScc, degScc[MAX_N], way[MAX_N];
bool ans[MAX_M];
vector<Edge> edge[MAX_N], edgeScc[MAX_N];
vector<int> nodesScc[MAX_N];

int dfn[MAX_N], low[MAX_N], scc[MAX_N], dfs_tick;
stack<int> stk;

void tarjan(int x) {
    dfn[x] = low[x] = ++dfs_tick;
    stk.push(x);
    for (Edge _i : edge[x]) {
        int i = _i.v;
        if (!dfn[i]) {
            tarjan(i);
            low[x] = min(low[x], low[i]);
        } else if (!scc[i]) low[x] = min(low[x], dfn[i]);
    }
    if (low[x] >= dfn[x]) {
        nScc++;
        while (stk.top() != x) scc[stk.top()] = nScc, nodesScc[nScc].push_back(stk.top()), stk.pop();
        scc[stk.top()] = nScc; nodesScc[nScc].push_back(stk.top()); stk.pop();
    }
}

vector<Edge> edge_local[MAX_N];
vector<pair<int, int>> back[MAX_N];
bool in_stk[MAX_N];

void tarjan_local(int x, vector<int> &edge_tree) {
    low[x] = dfn[x] = ++dfs_tick;
    stk.push(x); in_stk[x] = true;
    back[x].clear();
    back[x].emplace_back(dfn[x], 0);
    back[x].emplace_back(dfn[x], 0);
    for (Edge _i : edge_local[x]) {
        int i = _i.v;
        if (!dfn[i]) {
            edge_tree.push_back(_i.id);
            tarjan_local(i, edge_tree);
            low[x] = min(low[x], low[i]);
            back[x].insert(back[x].end(), back[i].begin(), back[i].end());
        } else if (in_stk[i]) {
            low[x] = min(low[x], dfn[i]);
            back[x].emplace_back(dfn[i], _i.id);
        }
    }
    sort(back[x].begin(), back[x].end());
    back[x].resize(2);
    if (dfn[x] != 1 && back[x][1].first >= dfn[x]) {
        ans[back[x][0].second] = true;
    }
    if (low[x] >= dfn[x]) {
        while (stk.top() != x) in_stk[stk.top()] = false, stk.pop();
        in_stk[stk.top()] = false; stk.pop();
    }
}

void tarjan_check(int x, int &scc_cnt) {
    low[x] = dfn[x] = ++dfs_tick;
    stk.push(x); in_stk[x] = true;
    for (Edge _i : edge_local[x]) {
        int i = _i.v;
        if (!dfn[i]) {
            tarjan_check(i, scc_cnt);
            low[x] = min(low[x], low[i]);
        } else if (in_stk[i]) {
            low[x] = min(low[x], dfn[i]);
        }
    }
    if (low[x] >= dfn[x]) {
        scc_cnt++;
        while (stk.top() != x) in_stk[stk.top()] = false, stk.pop();
        in_stk[stk.top()] = false; stk.pop();
    }
}

void solve(int cid) {
    vector<int> edge_tree;
    for (int i : nodesScc[cid]) {
        for (Edge _j : edge[i]) {
            int j = _j.v;
            if (scc[j] == cid) {
                edge_local[i].push_back(_j);
            }
        }
    }
    for (int i : nodesScc[cid]) dfn[i] = low[i] = 0;
    dfs_tick = 0;
    tarjan_local(nodesScc[cid][0], edge_tree);
    for (int i : edge_tree) {
        for (int j : nodesScc[cid]) edge_local[j].clear(), dfn[j] = low[j] = 0;
        dfs_tick = 0;
        for (int j : nodesScc[cid]) {
            for (Edge _k : edge[j]) {
                int k = _k.v;
                if (scc[k] != cid) continue;
                if (_k.id != i) edge_local[j].push_back(_k);
                else edge_local[k].emplace_back(j, 0);
            }
        }
        int scc_cnt = 0;
        for (int j : nodesScc[cid])
            if (!dfn[j])
                tarjan_check(j, scc_cnt);
        if (scc_cnt != 1) ans[i] = true;
    }
}

int main() {
    scanf("%d%d", &N, &M);
    for (int i = 1; i <= M; i++) {
        int a, b; scanf("%d%d", &a, &b);
        edge[a].emplace_back(b, i);
    }
    for (int i = 1; i <= N; i++)
        if (!dfn[i])
            tarjan(i);
    for (int i = 1; i <= N; i++)
        for (Edge _j : edge[i]) {
            int j = _j.v;
            if (scc[i] == scc[j]) continue;
            edgeScc[scc[i]].emplace_back(scc[j], _j.id), degScc[scc[j]]++;
        }
    for (int i = 1; i <= nScc; i++) {
        fill_n(way + 1, nScc, 0);
        way[i] = 1;
        for (int j = nScc; j; j--) {
            for (Edge _k : edgeScc[j]) {
                int k = _k.v;
                way[k] = min(2, way[k] + way[j]);
            }
        }
        for (Edge _j : edgeScc[i]) {
            int j = _j.v;
            if (way[j] > 1) {
                ans[_j.id] = true;
            }
        }
    }
    for (int i = 1; i <= nScc; i++) {
        solve(i);
    }
    for (int i = 1; i <= M; i++)
        printf(ans[i] ? "diff\n" : "same\n");
}


Measured memory_bytes: 8832