#include<bits/stdc++.h>
using namespace std;
const int N=1e3+1;
int n,m,sum;
int f[N][N][2],e[N*N][2],g[N],a[N*N][2];
auto F=f[0];
bool bz[N],bz1[N];
void ins(int x,int y){
    static int sum=1;
    a[++sum][0]=y,a[sum][1]=g[x],g[x]=sum;
}
void dfs(int x,int s,int v,int dep){ 
    static int y;
    if (dep>100)return;
    for (int i=g[x];i&&sum;i=a[i][1])
        if (a[i][0]!=s){
            y=a[i][0];
            if (x==s)v=y;
            if (F[y][0]==v||F[y][1]==v||(F[y][0]&&F[y][1])){
                bz1[x]|=bz1[y];
                continue;
            }
            if (!F[y][0]){
                F[y][0]=v;
                dfs(y,s,v,dep+1);
                bz1[x]|=bz1[y];
            }else{
                F[y][1]=v;
                if (bz[y])sum--,bz[y]=0;
                if (!sum)return;
                if (bz1[y])dfs(y,s,v,dep+1);
            }
        }
}
inline int read() {
    char ch = getchar(); int x = 0, f = 1;
    while(ch < '0' || ch > '9') {
        if(ch == '-') f = -1;
        ch = getchar();
    } while('0' <= ch && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    } return x * f;
}
int main(){
    n=read();
    m=read();
    for (int i=1;i<=m;i++){
        e[i][0]=read();
        e[i][1]=read();
        ins(e[i][0],e[i][1],0);
    }
    for (int i=1;i<=n;i++){
        F=f[i];
        for (int j=1;j<=n;j++)bz1[j]=0;
        for (int j=g[i];j;j=a[j][1])sum++,bz1[a[j][0]]=bz[a[j][0]]=1;
        dfs(i,i,0);
    }
    for (int i=1;i<=m;i++){
        bool sig=f[e[i][1]][e[i][0]][0];
        bool sig1=((f[e[i][0]][e[i][1]][0]&&f[e[i][0]][e[i][1]][0]!=e[i][1])||(f[e[i][0]][e[i][1]][1]&&f[e[i][0]][e[i][1]][1]!=e[i][1]));
        sig==sig1?printf("same\n"):printf("diff\n");
    }
    return 0;
}