// 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.3135916122386275x):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<vector>

#define maxn 1005

#define maxm 200005

using namespace std;

inline int qread(){

	int x=0,sign=1;

	char c=getchar();

	while(c<'0'||c>'9'){

		if(c=='-') sign=-1;

		c=getchar();

	}

	while(c>='0'&&c<='9'){

		x=x*10+c-'0';

		c=getchar();

	}

	return x*sign;

}

int n,m; 

int s[maxm],e[maxm];

vector<int>E[maxn];

void add_edge(int u,int v){

	E[u].push_back(v);

}

int used[maxn];

int route[maxn][maxn];

void dfs(int s,int x){

	int y;

	used[x]=1;

	route[s][x]++;

	int cnt=E[x].size();

	for(int i=0;i<cnt;i++){

		y=E[x][i];

		if(y==s) continue;

		if(!used[y]&&route[s][y]<2){

			dfs(s,y);

		}

	}

}



int judge(int u,int v){//1为diff,0为same 

	if(route[v][u]>0){//在一个SCC中 

		if(route[u][v]>=2) return 0;

		else return 1; 

	}else{//不在一个SCC中 

		if(route[u][v]>=2) return 1;

		else return 0;

	}

}



char a[]="same",b[]="diff";

void qprint(char *s,int len){

	for(int i=0;i<len;i++){

		putchar(s[i]);

	}

	putchar('\n');

}

int main(){

//	scanf("%d %d",&n,&m);

	n=qread();

	m=qread(); 

	int u,v;

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

//		scanf("%d %d",&u,&v);

		s[i]=qread();

		e[i]=qread();

		add_edge(s[i],e[i]);

	}

	int y;

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

		int cnt=E[i].size();

		for(int j=0;j<cnt;j++){

			y=E[i][j];

			if(route[i][y]<2){

				memset(used,0,sizeof(used));

				dfs(i,y);

			}

		}

	}

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

//		for(int j=1;j<=n;j++){

//			printf("%d ",route[i][j]);

//		}

//		printf("\n");

//	}

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

		if(judge(s[i],e[i]) )qprint(b,4);

		else qprint(a,4);

	}

}