#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define mp std::make_pair
#define pb push_back
#define X first
#define Y second
typedef long long ll; 
int n, m; 
bool can[1005][1005], vis[1005], ans[200005]; 
std::vector<std::pair<int, int> > adj[1005]; 
void dfs(int rt, int u)
{
	vis[u] = true; 
	for (auto it : adj[u])
	{
		if (it.first == rt || vis[it.first])
			continue; 
		dfs(rt, it.first); 
	}
}
void work()
{
	for (int i = 0; i < n; i++)
	{
		memset(vis, false, sizeof(vis)); 
		for (auto it : adj[i])
		{
			if (vis[it.first])
				ans[it.second] = true; 
			else
				dfs(i, it.first); 
		}
	}
}
void fill(int rt, int u)
{
	if (can[rt][u])
		return; 
	can[rt][u] = true; 
	for (auto it : adj[u])
		fill(rt, it.first); 
}
int main()
{
	// freopen("ARC092-F.in", "r", stdin); 
	scanf("%d%d", &n, &m); 
	for (int i = 0; i < m; i++)
	{
		int u, v; 
		scanf("%d%d", &u, &v); 
		adj[--u].pb(mp(--v, i)); 
	}
	for (int i = 0; i < n; i++)
		fill(i, i); 
	work(); 
	for (int i = 0; i < n; i++)
		std::reverse(adj[i].begin(), adj[i].end()); 
	work(); 
	for (int i = 0; i < n; i++)
	{
		for (auto it : adj[i])
			ans[it.second] ^= can[it.first][i]; 
	}
	for (int i = 0; i < m; i++)
		puts(ans[i] ? "diff" : "same"); 
	return 0; 
}
