#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=2010,M=2e5+10;
struct node{int to,num;};
vector<node>v[N];
int n,m,ans[M][2],num[N],q[M*10];
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
        {int x,y;scanf("%d%d",&x,&y);v[x].push_back((node){y,i});}
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)num[j]=0;
        int hd=1,tl=0;
        for(int j=0;j<v[i].size();j++)
            num[v[i][j].to]=v[i][j].num,q[++tl]=v[i][j].to;
        while(hd<=tl)
        {
            int s1=q[hd++],z=num[s1];
            for(int j=0;j<v[s1].size();j++)
            {
                int s2=v[s1][j].to;
                if(s2==i)ans[v[s1][j].num][0]=1;
                else if(num[s2]!=-1)
                {
                    if(!num[s2])num[s2]=z,q[++tl]=s2;
                    else if(num[s2]!=z)num[s2]=-1,q[++tl]=s2;
                }
            }
        }
        for(int j=0;j<v[i].size();j++)
            ans[v[i][j].num][1]|=num[v[i][j].to]==-1;
    }
    for(int i=1;i<=m;i++)printf("%s\n",ans[i][0]==ans[i][1]?"same":"diff");
}
