#include <bits/stdc++.h>
using namespace std;
#define N 2010
#define M 200010
#define pb push_back
vector<int> v[N];
int vis[N],c[N],X[M],Y[M],G1[N][N],G2[N][N];
inline int read() {
    int x=0;
    char ch=getchar();
    while (!isdigit(ch)) ch=getchar();
    while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
    return x;
}
inline void dfs1(int x,int st) {
    vis[x]=true,G1[st][x]=true;
    for (auto y:v[x]) if (!vis[y]) dfs1(y,st);
}
inline void dfs2(int x,int col,int k,int st) {
    if (k) G2[st][x]=(c[x]!=col); else c[x]=col;
    vis[x]=true; for (auto y:v[x]) if (!vis[y]) dfs2(y,col,k,st);
}
int main() {
    int n=read(),m=read();
    for (int i=1;i<=m;i++) {
        int x=read(),y=read();
        v[x].pb(y),X[i]=x,Y[i]=y;
    }
    for (int i=1;i<=n;i++) {
        memset(vis,0,sizeof(vis)),dfs1(i,i);
    }
    for (int i=1;i<=n;i++) {
        memset(vis,0,sizeof(vis)),vis[i]=true;
        memset(c,0,sizeof(c));
        for (int j=0;j<v[i].size();j++) 
            if (!vis[v[i][j]]) dfs2(v[i][j],j+1,0,i);
        memset(vis,0,sizeof(vis)),vis[i]=true;
        for (int j=v[i].size()-1;j>=0;j--)
            if (!vis[v[i][j]]) dfs2(v[i][j],j+1,1,i);
    }
    // for (int i=1;i<=n;i++,putchar('\n'))
        // for (int j=1;j<=n;j++) printf("%d ",G1[i][j]);
    for (int i=1;i<=m;i++) puts(G1[Y[i]][X[i]]^G2[X[i]][Y[i]]?"diff":"same");
    return 0;
}