#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
int n,m,u,v,dp[1007][1007];
bool vis[1007];
pair <int,int> ed[200007];
vector <int> edge[1007];
void dfs(int u,int par,int from){
	if(u==from) return;
	if(dp[from][u]==2) return;
	if(dp[from][u]==1 && vis[u]) return;
	dp[from][u]++, vis[u]=true;
	for(int v:edge[u]){
		if(v==par) continue;
		dfs(v,u,from);
	}
}
int main(){
	ios_base::sync_with_stdio(0);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>u>>v;
		edge[u].pb(v);
		ed[i]=mp(u,v);
	}
	for(int i=1;i<=n;i++){
		for(int x:edge[i]){
			memset(vis,false,sizeof(vis));
			dfs(x,i,i);
		}
	}
	for(int i=1;i<=m;i++){
		u=ed[i].fi;
		v=ed[i].se;
		bool ok=true;
		if(dp[u][v]>=2){
			if(dp[v][u]==0) ok=true;
			else ok=false;
		}
		else{
			if(dp[v][u]>=1) ok=true;
			else ok=false;
		}
		if(ok) cout<<"diff\n";
		else cout<<"same\n";
	}
}
