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

const int N = 1010;

typedef pair<int, int> P;

#define fir first
#define sec second

vector<P> G[N];

bool mark[N][N], mp[N][N], vis[N]; int ct[N][N];

int rt, n; 

void dfs(int u, int type) {
    vis[u] = 1;
    if (mp[rt][u] && !mark[rt][u]) ct[rt][u] |= 1;
    if (!type) {
        for (auto v : G[u]) if (!vis[v.sec])
            mark[u][v.sec] = 1, dfs(v.sec, type), mark[u][v.sec] = 0;
    } else for (int i = G[u].size() - 1; i >= 0; i--) if (!vis[G[u][i].sec])
        mark[u][G[u][i].sec] = 1, dfs(G[u][i].sec, type), mark[u][G[u][i].sec] = 0;
}

inline void clr() {
    for (int i = 1; i <= n; i++) vis[i] = 0;
}

inline void solve(int u) {
    rt = u, clr(), dfs(u, 0), clr(), dfs(u, 1);
    for (int i = 1; i <= n; i++) if (vis[i]) ct[i][u] |= 2;
}

int ans[N * 200];

int main() {
    int m; scanf("%d%d", &n, &m);
    for (int i = 1, a, b; i <= m; i++) scanf("%d%d", &a, &b), G[a].push_back(P(i, b)), mp[a][b] = 1;
    for (int i = 1; i <= n; i++) sort(G[i].begin(), G[i].end());
    for (int i = 1; i <= n; i++) solve(i);
    for (int i = 1; i <= n; i++) for (auto v : G[i]) 
        if (ct[i][v.sec] != 0 && ct[i][v.sec] != 3) ans[v.fir] = 1;
    for (int i = 1; i <= m; i++) puts(ans[i] ? "diff" : "same");

}