#include <cstdio>
#include <vector>
#define FOR(i, l, r) for(int i = l; i <= r; ++i)

using namespace std;

const int N = 1010;
const int M = 200010;

int n, m, cnt, x[M], y[M], a[2][N][N];
vector <int> v[N];

void dfs(int fl, int x, int st, int fir)
{
    a[fl][st][x] = fir;
    for(int i = 0; i < v[x].size(); ++i)
        if (!a[fl][st][v[x][i]]) dfs(fl, v[x][i], st, fir);
}

char B[1 << 26], *S = B;
#define getchar() (*S++)
int read()
{
    int x = 0; char c = getchar();
    while (c < '0' || c > '9') c = getchar();
    while (c >= '0' && c <= '9') {x = x * 10 + c - '0'; c = getchar();}
    return x;
}

int main()
{
    fread(B, 1, 1 << 26, stdin);
    n = read(); m = read();
    FOR(i, 1, m)
    {
        x[i] = read(); y[i] = read();
        v[x[i]].push_back(y[i]);
    }
    FOR(i, 1, n)
    {
        a[0][i][i] = a[1][i][i] = i;
        for(int j = 0; j < v[i].size(); ++j) if (!a[0][i][v[i][j]]) dfs(0, v[i][j], i, v[i][j]);
        if (v[i].size()) for(int j = v[i].size() - 1; ~j; --j) if (!a[1][i][v[i][j]]) dfs(1, v[i][j], i, v[i][j]);
    }
    FOR(i, 1, m) if (((bool) a[0][y[i]][x[i]]) ^ (a[0][x[i]][y[i]] != a[1][x[i]][y[i]]))
        puts("diff"); else puts("same");
    return 0;
}
