#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 vis[N]; int ct[N][N], wkr[N];

int rt, n, col; 

void dfs(int u, int type) {
    if (!type) wkr[u] = col;
    else if (wkr[u] != col) ct[rt][u] |= 1;
    vis[u] = 1;
    for (auto v : G[u]) if (!vis[v.sec]) dfs(v.sec, type);
}

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

inline void solve(int u) {
    rt = u, clr(), vis[u] = 1;
    for (auto v : G[u]) if (!vis[v.sec]) dfs(col = v.sec, 0);
    clr(), vis[u] = 1;
    for (int i = (int)G[u].size() - 1; i >= 0; i--) if (!vis[G[u][i].sec]) dfs(col = G[u][i].sec, 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));
    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");

}