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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

namespace SCC{
    void visit(const vector<vector<int>>&G,vector<int>&vs,vector<int>&used,int v){
        used[v]=true;
        for(auto u:G[v]){
            if(!used[u])visit(G,vs,used,u);
        }
        vs.push_back(v);
    }

    void visit2(const vector<vector<int>>&T,vector<int>&used,vector<int>&comp,vector<int>&vec,int k,int v){
        comp[v]=k;
        used[v]=true;
        vec.push_back(v);

        for(auto u:T[v]){
            if(!used[u])visit2(T,used,comp,vec,k,u);
        }
    }

    void decompose(const vector<vector<int>>&G,vector<vector<int>>&H,vector<int>&comp){
        vector<vector<int>>T(G.size());
        for(int i=0;i<G.size();i++){
            for(auto v:G[i]){
                T[v].push_back(i);
            }
        }
        comp.resize(G.size());

        vector<int>vs(G.size());
        vector<int>used(G.size());
        for(int i=0;i<G.size();i++){
            if(!used[i])visit(G,vs,used,i);
        }
        reverse(vs.begin(),vs.end());
        fill(used.begin(),used.end(),0);

        int K=0;
        vector<vector<int>>S;
        for(auto v:vs){
            if(!used[v]){
                S.push_back(vector<int>());
                visit2(T,used,comp,S.back(),K++,v);
            }
        }

        H.resize(K);
        fill(used.begin(),used.end(),0);
        for(int i=0;i<K;i++){
            for(auto v:S[i]){
                for(auto u:G[v]){
                    if(comp[v]==comp[u])continue;
                    H[comp[v]].push_back(comp[u]);
                }
            }
        }

    }
}



int N,M;
int A[222222],B[222222];
bool ans[222222];

vector<vint>g;
vector<vint>rg;
vint comp;

bool mark[2222];
int semi[2222];
void dfs(int v,int se){
    semi[v]=se;
    for(auto u:g[v]){
        if(comp[v]!=comp[u])continue;
        if(semi[u]!=-1)continue;
        if(se==-5)dfs(u,u);
        else dfs(u,se);
    }
}

bool re[2222];
void dfs2(int v){
    re[v]=true;
    for(auto u:rg[v]){
        if(semi[v]!=semi[u])continue;
        if(re[u])continue;
        dfs2(u);
    }
}

signed main(){
    scanf("%lld%lld",&N,&M);
    g.resize(N);rg.resize(N);
    rep(i,M){
        scanf("%lld%lld",&A[i],&B[i]);
        A[i]--;B[i]--;
        g[A[i]].pb(B[i]);
        rg[B[i]].pb(A[i]);
    }



    vector<vint>h;
    SCC::decompose(g,h,comp);

    set<pint>latte;

    rep(s,h.size()){
        vint ei(h.size());
        ei[s]=1;
        for(int v=s;v<h.size();v++){
            for(auto u:h[v]){
                ei[u]+=ei[v];
            }
        }
        for(auto u:h[s]){
            if(ei[u]!=1)latte.insert({s,u});
        }
    }
    rep(i,M){
        if(latte.find({comp[A[i]],comp[B[i]]})!=latte.end())ans[i]=true;
    }

    latte=set<pint>();
    rep(i,N){
        memset(semi,-1,sizeof(semi));
        memset(re,0,sizeof(re));
        memset(mark,0,sizeof(mark));

        dfs(i,-5);
        rep(j,N)if(j==semi[j])dfs2(j);
        rep(j,M)if(comp[A[j]]==comp[i]&&comp[B[j]]==comp[i]&&semi[A[j]]!=semi[B[j]]&&(A[j]!=i||semi[B[j]]!=B[j]))mark[B[j]]=true;

        rep(j,N)if(mark[j]&&re[j])mark[semi[j]]=true;
        for(auto u:g[i])if(u==semi[u]&&!mark[u])latte.insert({i,u});
    }

    rep(i,M){
        if(latte.find({A[i],B[i]})!=latte.end())ans[i]=true;
    }


    rep(i,M){
        if(ans[i])puts("diff");
        else puts("same");
    }
    return 0;
}


Measured memory_bytes: 23424