#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

typedef pair<int, int> ii;

const int N = 1005;

vector<int> graph[N];

int n, m, l[200005], r[200005], cnt[N][N], vis[N][N];

void dfs(int u, int p, int root, int mark) {
    if(u == root) return ;
    if(cnt[root][u] >= 2) return ;
    if(vis[root][u] == mark) return ;
    vis[root][u] = mark; cnt[root][u]++;
    for(int i = 0; i < graph[u].size(); i++) {
        int v = graph[u][i];
        if(v == p) continue;
        dfs(v, u, root, mark);
    }
}

int main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> n >> m;
    for(int i = 1; i <= m; i++) {
        cin >> l[i] >> r[i];
        graph[l[i]].pb(r[i]);
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 0; j < graph[i].size(); j++) {
            int v = graph[i][j];
            dfs(v, i, i, v);
        }
    }
    for(int i = 1; i <= m; i++) {
        if(cnt[l[i]][r[i]] >= 2) {
            if(cnt[r[i]][l[i]] == 0)
                cout << "diff\n";
            else
                cout << "same\n";
        }
        else {//1
            if(cnt[r[i]][l[i]] >= 1)
                cout << "diff\n";
            else
                cout << "same\n";
        }
    }
}
