#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>

inline void read(int &x)
{
	char c=x=0;
	for(c=getchar();!isdigit(c);c=getchar());
	for(;isdigit(c);c=getchar())x=x*10+(c^48);
}

namespace o_o
{
	const int N=1010,M=200100;

//	bool g[N][N],ans[N][N];
//	int f0[N],f1[N];

	int f[N][N],vis[N];

	std::vector<int>G[N];

	void Dfs(int p,int h,int fk)
	{
		if(f[h][p]>1 || p==h || vis[p]==fk)return;
		vis[p]=fk;

		f[h][p]++;

		for(int i=0;i<(int)G[p].size();i++)
			Dfs(G[p][i],h,fk);
//		for(auto q:G[p])
//		{
//			Dfs(q,h,fk);
//		}
	}

	int n,m;

	int E[M][2];

	void solve()
	{
		read(n),read(m);
		for(int i=1,u,v;i<=m;i++)
			read(u),read(v),E[i][0]=u,E[i][1]=v,G[u].push_back(v);

		for(int i=1;i<=n;i++)
		{
//			if(i%100==0)fprintf(stderr,"i = %d\n",i);
//			work(i);
			memset(vis,0,sizeof(vis));
			for(auto q:G[i])Dfs(q,i,q);
		}

		for(int i=1;i<=m;i++)
		{
			int u=E[i][0],v=E[i][1];
			if((f[v][u]>=1)^(f[u][v]>=2))printf("diff\n");
			else printf("same\n");
		}
	}
}

int main()
{
//	freopen("D.in","r",stdin);
//	freopen("D.out","w",stdout);
	o_o::solve();
//	fprintf(stderr,"time = %lf\n",(double)clock()/CLOCKS_PER_SEC);
	return 0;
}
