#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < int(n); ++ (i))
#define ALL(x) begin(x), end(x)
using namespace std;

vector<vector<int> > opposite_graph(vector<vector<int> > const & g) {
    int n = g.size();
    vector<vector<int> > h(n);
    REP (i, n) for (int j : g[i]) h[j].push_back(i);
    return h;
}
pair<int, vector<int> > decompose_to_strongly_connected_components(vector<vector<int> > const & g, vector<vector<int> > const & g_rev) {
    int n = g.size();
    vector<int> acc(n); {
        vector<bool> used(n);
        function<void (int)> dfs = [&](int i) {
            used[i] = true;
            for (int j : g[i]) if (not used[j]) dfs(j);
            acc.push_back(i);
        };
        REP (i,n) if (not used[i]) dfs(i);
        reverse(ALL(acc));
    }
    int size = 0;
    vector<int> component_of(n); {
        vector<bool> used(n);
        function<void (int)> rdfs = [&](int i) {
            used[i] = true;
            component_of[i] = size;
            for (int j : g_rev[i]) if (not used[j]) rdfs(j);
        };
        for (int i : acc) if (not used[i]) {
            rdfs(i);
            ++ size;
        }
    }
    return { size, move(component_of) };
}
vector<vector<int> > decomposed_graph(int size, vector<int> const & component_of, vector<vector<int> > const & g) {
    int n = g.size();
    vector<vector<int> > h(size);
    REP (i, n) for (int j : g[i]) {
        if (component_of[i] != component_of[j]) {
            h[component_of[i]].push_back(component_of[j]);
        }
    }
    REP (k, size) {
        sort(ALL(h[k]));
        h[k].erase(unique(ALL(h[k])), h[k].end());
    }
    return h;
}

template <typename AdjacencyList>
bool breadth_first_search(int n, int src, int dst, AdjacencyList for_each_adjacent_vertex) {
    vector<int> dist(n, INT_MAX);
    queue<int> que;
    dist[src] = 0;
    que.push(src);
    while (not que.empty()) {
        int i = que.front(); que.pop();
        if (i == dst) return true;
        for_each_adjacent_vertex(i, [&](int j) {
            if (dist[j] == INT_MAX) {
                dist[j] = dist[i] + 1;
                que.push(j);
            }
        });
    }
    return false;
}

vector<bool> solve(int n, int m, vector<int> const & a, vector<int> const & b) {
    // prepare graphs
    vector<vector<int> > g(n);
    REP (i, m) {
        g[a[i]].push_back(b[i]);
    }
    int size; vector<int> component_of; tie(size, component_of) = decompose_to_strongly_connected_components(g, opposite_graph(g));
    vector<vector<int> > h = decomposed_graph(size, component_of, g);
    // check for each edge
    vector<bool> diff(m);
    REP (i, m) {
        if (component_of[a[i]] == component_of[b[i]]) {
            diff[i] = not breadth_first_search(n, a[i], b[i], [&](int j, auto callback) {
                for (int k : g[j]) if (component_of[k] == component_of[a[i]]) {
                    if (j == a[i] and k == b[i]) continue;
                    callback(k);
                }
            });
        } else {
            diff[i] = breadth_first_search(size, component_of[a[i]], component_of[b[i]], [&](int j, auto callback) {
                for (int k : h[j]) {
                    if (j == component_of[a[i]] and k == component_of[b[i]]) continue;
                    callback(k);
                }
            });
        }
    }
    return diff;
}

int main() {
    int n, m; cin >> n >> m;
    vector<int> a(m), b(m);
    REP (i, m) {
        cin >> a[i] >> b[i];
        -- a[i];
        -- b[i];
    }
    vector<bool> answer = solve(n, m, a, b);
    REP (i, m) {
        cout << (answer[i] ? "diff" : "same") << endl;
    }
    return 0;
}
