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

vector<pair<int, int>> edges[1000], rev[1000];
bitset<200000> cond1, cond2;

bitset<1000> visited;
void dfs(int i){
    if(visited[i]) return;
    visited[i] = 1;
    for(auto& p : edges[i]) if(!visited[p.second]) dfs(p.second);
}

int main(){
    int N, M;
    cin >> N >> M;
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a >> b;
        edges[a-1].push_back({i, b-1});
        rev[b-1].push_back({i, a-1});
    }
    for(int i=0; i<N; i++){
        visited.reset();
        dfs(i);
        for(auto& p : rev[i]) if(visited[p.second]) cond1[p.first] = 1;
    }

    for(int i=0; i<N; i++){
        for(int t=0; t<2; t++){
            visited.reset();
            visited[i] = 1;
            for(auto& p : edges[i]){
                if(visited[p.second]) cond2[p.first] = 1;
                dfs(p.second);
            }
            reverse(edges[i].begin(), edges[i].end());
        }
    }

    for(int i=0; i<M; i++){
        cout << (cond1[i] == cond2[i] ? "same" : "diff") << endl;
    }
    return 0;
}
