#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int n;
int a[200000];
int b[200000];
int c[1000][1000][2];
int f[1000];
vector <pair<int, int>> v[1000];

void dfs(int x, int y, int z, int w) {
    int i;
    
    f[x] = 1;
    c[y][x][z] = w;
    
    for (i = 0; i < v[x].size(); i++) {
        int nx = v[x][i].first;
        
        if (f[nx] == 0) dfs(nx, y, z, w);
    }
}

void check(int x) {
    int i, j;
    
    for (i = 0; i < n; i++) {
        c[x][i][0] = 1e9;
        c[x][i][1] = -1e9;
    }
    
    for (i = 0; i < n; i++) f[i] = 0;
    f[x] = 1;
    
    for (i = 0; i < v[x].size(); i++) {
        int nx = v[x][i].first;
        
        if (f[nx] == 0) dfs(nx, x, 0, v[x][i].second);
    }
    
    for (i = 0; i < n; i++) f[i] = 0;
    f[x] = 1;
    
    reverse(v[x].begin(), v[x].end());
    for (i = 0; i < v[x].size(); i++) {
        int nx = v[x][i].first;
        
        if (f[nx] == 0) dfs(nx, x, 1, v[x][i].second);
    }
}

int main() {
    int m, i, j;
    
    scanf("%d %d", &n, &m);
    
    for (i = 0; i < m; i++) {
        scanf("%d %d", &a[i], &b[i]);
        
        a[i]--;
        b[i]--;
        
        v[a[i]].push_back(make_pair(b[i], i));
    }
    
    for (i = 0; i < n; i++) check(i);
    
    for (i = 0; i < m; i++) {
        int x = a[i], y = b[i];
        int f1 = 0, f2 = 0;
        
        if (c[x][y][0] < i || c[x][y][1] > i) f1 = 1;
        if (c[y][x][1] >= 0) f2 = 1;
        
        if (f1 ^ f2) {
            puts("diff");
        } else {
            puts("same");
        }
    }
    
    return 0;
}
