#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define pb(a) push_back(a)
using namespace std;

int read() {
	char ch;
	for(ch=getchar();ch<'0'||ch>'9';ch=getchar());
	int x=ch-'0';
	for(ch=getchar();ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

const int N=1e3+5,M=2e5+5;

int n,m,u[M],v[M],p[N],mn[N],mx[N],id;
vector<int> to[N];
bool vis[N],can[N][N],path[N][N];

void dfs(int x) {
	vis[x]=1;
	for(int y:to[x]) if (!vis[y]) dfs(y);
}

void dfs_mn(int x) {
	if (mn[x]) return;
	mn[x]=id;for(int y:to[x]) dfs_mn(y);
}

void dfs_mx(int x) {
	if (mx[x]) return;
	mx[x]=id;for(int y:to[x]) dfs_mx(y);
}

int main() {
	n=read();m=read();
	fo(i,1,m) {
		u[i]=read();v[i]=read();
		to[u[i]].pb(v[i]);
	}
	fo(i,1,n) {
		fo(j,1,n) vis[j]=0;
		dfs(i);
		fo(j,1,n) can[i][j]=vis[j];
	}
	fo(i,1,n) {
		fo(j,1,n) mn[j]=mx[j]=0;mn[i]=mx[i]=1;
		int t=0;for(int x:to[i]) p[++t]=x;
		fo(j,1,t) id=j,dfs_mn(p[j]);
		fd(j,t,1) id=j,dfs_mx(p[j]);
		fo(j,1,t) path[i][p[j]]=mn[p[j]]<mx[p[j]];
	}
	fo(i,1,m) puts(can[v[i]][u[i]]^path[u[i]][v[i]]?"diff":"same");
	return 0;
}