#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
const int INF=0x7f7f7f7f;
const int maxn=(2e5)+10;
int n,m;
int to[maxn],from[maxn],S;
bool mk[1010][1010],dis[1010][1010],vis[1010];
vector<int> g[1010];
void dfs(int u) {
	vis[u]=1;
	mk[S][u]=1;
	for (int i=0,v;i<g[u].size();i++) {
		v=g[u][i];
		if (!vis[v]) dfs(v);
	}
}
int main() {
	//freopen("1.txt","r",stdin);
	read(n); read(m);
	for (int i=1;i<=m;i++) {
		read(from[i]); read(to[i]);
		g[from[i]].push_back(to[i]);
	}
	int x,y;
	for (S=1;S<=n;S++) {
		memset(vis,0,sizeof(vis));
		vis[S]=1;
		for (int i=0,v;i<g[S].size();i++) {
			v=g[S][i];
			if (!vis[v]) dfs(v);
			else dis[S][v]=1;
		}
		memset(vis,0,sizeof(vis));
		vis[S]=1;
		for (int i=g[S].size()-1,v;i>=0;i--) {
			v=g[S][i];
			if (!vis[v]) dfs(v);
			else dis[S][v]=1;
		}
	}
	for (int i=1;i<=m;i++) {
		x=from[i],y=to[i];
		if (dis[x][y]==mk[y][x]) printf("same\n");
		else printf("diff\n");
	}
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Interger overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/