// Slower C++ solution:
#include<bits/stdc++.h> //Ithea Myse Valgulious

namespace chtholly{

typedef long long ll;

#define re0 register int

#define rec register char

#define rel register ll

#define gc getchar

#define pc putchar

#define p32 pc(' ')

#define pl puts("")

/*By Citrus*/

inline int read(){

  int x=0,f=1;char c=gc();

  for (;!isdigit(c);c=gc()) f^=c=='-';

  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');

  return f?x:-x;

  }

template <typename mitsuha>

inline bool read(mitsuha &x){

  x=0;int f=1;char c=gc();

  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';

  if (!~c) return 0;

  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');

  return x=f?x:-x,1;

  }

template <typename mitsuha>

inline int write(mitsuha x){

  if (!x) return 0&pc(48);

  if (x<0) x=-x,pc('-');

  int bit[20],i,p=0;

  for (;x;x/=10) bit[++p]=x%10;

  for (i=p;i;--i) pc(bit[i]+48);

  return 0;

  }

inline char fuhao(){

  char c=gc();

  for (;isspace(c);c=gc());

  return c;

  }

}using namespace chtholly;

using namespace std;

const int yuzu=2e5;

typedef int fuko[yuzu|10];

fuko u,v;int vis[2][yuzu>>6][yuzu>>6];

vector<int> lj[yuzu|10];



void dfs(int id,int p,int u,int col){

if (vis[id][p][u]) return;

vis[id][p][u]=col;

for (int i:lj[u]) dfs(id,p,i,col);

}



int main(){

int i,n=read(),m=read();

for (i=1;i<=m;++i){

  u[i]=read(),v[i]=read();

  lj[u[i]].push_back(v[i]);

  } 

for (i=1;i<=n;++i){

  vis[0][i][i]=vis[1][i][i]=1;

  int now=0;for (int j:lj[i]) dfs(0,i,j,++now);

  if (lj[i].size()) for (int j=lj[i].size()-1;~j;--j) dfs(1,i,lj[i][j],j+1);

  }

for (i=1;i<=m;++i){

  puts((vis[0][u[i]][v[i]]!=vis[1][u[i]][v[i]])^(vis[0][v[i]][u[i]]>0)?"diff":"same");

  }

}

// Faster C++ solution for the same problem (measured speedup: 6.261855129654795x):
#include<iostream>

#include<algorithm>

#include<cstdio>

#include<cstring>

#include<cmath>

#include<vector>

using namespace std;

#define REP(i,a,b) for(register int i=a;i<=b;++i)

#define DREP(i,a,b) for(register int i=a;i>=b;--i)

#define mem(a) memset(a,0,sizeof(a))

inline char get_char(){

	static char buf[1000000],*p1,*p2;

    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;

}

inline int read(){

    int numm=0;

    char _;_=get_char();

    while(_<'0'||_>'9'){_=get_char();} 

    while(_>='0'&&_<='9'){numm=(numm<<3)+(numm<<1)+(_^48);_=get_char();   }

    return numm;

}

const int maxn=1000+10;

const int maxm=200000+10;

vector<int>E[maxn];

int n,m,beg[maxn],len,num[maxn][maxn];

bool can[maxn][maxn],vis[maxn],can1[maxn][maxn];

int vis1[maxn],vis2[maxn],from[maxm],to[maxm];

void dfs(int u,int rt){

	vis[u]=1;

	can[rt][u]=1;

	int size=E[u].size()-1;

	REP(i,0,size){

		int v=E[u][i];

		if(vis[v])continue;

		dfs(v,rt);

	}

}

void dfs1(int u){

	vis[u]=1;

	int size=E[u].size()-1;

	REP(i,0,size){

		int v=E[u][i];

		if(vis[v])continue;

		vis1[v]=num[u][v];

		dfs1(v);

	}

}

void dfs2(int u){

	vis[u]=1;

	int size=E[u].size()-1;

	DREP(i,size,0){

		int v=E[u][i];

		if(vis[v])continue;

		vis2[v]=num[u][v];

		dfs2(v);

	}

}

int main(){

//	freopen("test.txt","r",stdin);

	n=read();m=read();

	REP(i,1,m){

		int u,v;

		u=read();v=read();

		E[u].push_back(v);

		num[u][v]=++len;

		from[len]=u;

		to[len]=v;

	}

	REP(i,1,n){

		dfs(i,i);

		mem(vis);

	}

	REP(i,1,n){

		dfs1(i);

		mem(vis);

		dfs2(i);

		mem(vis);

		int size=E[i].size()-1;

		REP(j,0,size){

			int v=E[i][j];

			if(vis1[v]!=num[i][v] || vis2[v]!=num[i][v])

				can1[i][v]=1;

		}

		mem(vis1);

		mem(vis2);

	}

	REP(i,1,m){

		int u=from[i],v=to[i];

		if((can[v][u]^can1[u][v])==0)

			puts("same");

		else puts("diff");

	}

	return 0;

}