#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, M;
    cin >> N >> M;
    vector<vector<int>> e(N);
    using P = pair<int, int>;
    vector<P> edge(M);
    vector<vector<int>> start(N);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        e[a].push_back(b);
        edge[i] = {a, b};
        start[a].push_back(i);
    }
    vector<vector<bool>> ok(N, vector<bool>(N, false));
    for (int i = 0; i < N; i++) {
        queue<int> q;
        q.push(i);
        ok[i][i] = true;
        while (not q.empty()) {
            const int s = q.front();
            q.pop();
            for (const int to : e[s]) {
                if (ok[i][to]) { continue; }
                ok[i][to] = true;
                q.push(to);
            }
        }
    }
    vector<bool> ans(M);
    for (int i = 0; i < N; i++) {
        vector<int> dp(N, -1);  // -1: yet, M: doubled
        queue<int> q;
        for (const int c : start[i]) {
            dp[edge[c].second] = c;
            q.push(edge[c].second);
        }
        while (not q.empty()) {
            const int s = q.front();
            q.pop();
            if (s == i) { continue; }
            for (const int to : e[s]) {
                i if (dp[to] == M or dp[to] == dp[s]) { continue; }
                if (dp[to] == -1) {
                    dp[to] = dp[s];
                    q.push(to);
                } else {
                    dp[to] = M;
                    q.push(to);
                }
            }
        }
        for (const int c : start[i]) {
            const bool ts = ok[edge[c].second][edge[c].first];
            const bool dst = dp[edge[c].second] == M;
            ans[c] = ts ^ dst;
        }
    }
    for (int i = 0; i < M; i++) { cout << (ans[i] ? "diff" : "same") << endl; }
    return 0;
}
