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

const int N = 1005;
const int M = 200005;
const int INF = 1000000000;
typedef long long i64;

vector<int> E[N];
int edge[M][2];
int ma[N][N], mi[N][N];
bool vis[N];

void dfs(int s, int now, int k, bool mark) {
    if (vis[now] || now == s) return ;
    vis[now] = true;
    if (mark) mi[s][now] = k;
    else ma[s][now] = k;
    for (auto i = E[now].begin(); i != E[now].end(); ++i) {
        dfs(s, *i, k, mark);
    }
}
int main ()
{
    int n, m, v;
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= m; ++i) {
        scanf("%d %d", &edge[i][0], &edge[i][1]);
        E[edge[i][0]].push_back(edge[i][1]);
    }
    for (int i = 1; i <= n; ++i) {
        memset(vis, false, sizeof(vis));
        int num = 0;
        for (auto j = E[i].begin(); j != E[i].end(); ++j) {
            dfs(i, *j, ++num, true);
        }
        memset(vis,false, sizeof(vis));
        reverse(E[i].begin(), E[i].end());
        num = E[i].size();
        for (auto j = E[i].begin(); j != E[i].end(); ++j) {
            dfs(i, *j, num--, false);
        }
    }
    for (int i = 1; i <= m; ++i) {
        if ((mi[edge[i][1]][edge[i][0]] > 0) == (ma[edge[i][0]][edge[i][1]] != mi[edge[i][0]][edge[i][1]])) {
            puts("same");
        }
        else {
            puts("diff");
        }
    }
    return 0;
}
