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

#include <stdio.h>

#include <string.h>

#include <utility>

#include <vector>

#include <set>

using namespace std;



void read(int &x)

{

	char ch=getchar();bool f=0;x=0;

	while(ch>'9'||ch<'0'){if(ch=='-')f=1;ch=getchar();}

	while(ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}

	if(f)x=-x;

} 



void read(long long &x)

{

	char ch=getchar();bool f=0;x=0;

	while(ch>'9'||ch<'0'){if(ch=='-')f=1;ch=getchar();}

	while(ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}

	if(f)x=-x;

}





vector <int> graph[1001];



void addedge(int u,int v)

{

	graph[u].push_back(v);

}



int vis[1001][1001];

struct

{

	int first,second;

}edge[200001];

int mark[1001];

int times=1;

int tmp;



void dfs(int from,int now)

{

	vis[from][now]++;

	mark[now]=times;

	for(auto to:graph[now])

	{

		if(to==from)continue;

		if(vis[from][to]<2&&mark[to]!=times)

		{

			dfs(from,to);

		}

	}

}



int main()

{

//	freopen("sep2_0.in","r",stdin);

//	freopen("sep.out","w",stdout);

	int n,m;

	read(n);read(m);

	for(int i=0;i<m;i++)

	{

		int from,to;

		read(from);read(to);

		addedge(from,to);

		edge[i].first=from;

		edge[i].second=to;

	}

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

	{

		for(auto to:graph[i])

		{

			if(vis[i][to]<2)

			{

				times++;

				dfs(i,to);

			}

		}

	}

	//return 0;

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

	{

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

		{

			cout<<"("<<vis[i][j]<<","<<vis2[i][j]<<")";

		}

		cout<<endl;

	}*/

	for(int i=0;i<m;i++)

	{

		int from=edge[i].first,to=edge[i].second;

		if(vis[to][from])

		{

			if(vis[from][to]>1)

			{

				puts("same");

			}

			else

			{

				puts("diff");

			}

		}

		else

		{

			if(vis[from][to]>1)

			{

				puts("diff");

			}

			else

			{

				puts("same");

			}

		}

	}

	return 0;

}