#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;

int n , vis[1001][1001], m, a[200001], b[200001], source, br, q[1001][1001], p[1001][1001];
vector<int> g[1001];

void dfs(int u) {
	if (vis[source][u])return;
	vis[source][u] = 1;
	for (int i = 0; i < g[u].size(); ++i)dfs(g[u][i]);
}
void pre(int u, int vis[]) {
	if (u == source)return;
	if (vis[u])return;
	vis[u] = br;
	for (int i = 0; i < g[u].size(); ++i)pre(g[u][i], vis);
}
int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; ++i) {
		scanf("%d%d", &a[i], &b[i]);
		g[a[i]].pb(b[i]);
	}
	for (source = 1; source <= n ; ++source) {
		dfs(source);
		for (int i = 0 ; i < g[source].size(); ++i) {
			br = g[source][i];
			pre(br, p[source]);
		}
		for (int i = g[source].size() - 1; i >= 0 ; --i) {
			br = g[source][i];
			pre(br, q[source]);
		}
	}
	for (int i = 0; i < m; ++i){
		bool yes = (vis[b[i]][a[i]] ^ (q[a[i]][b[i]]!=b[i] || p[a[i]][b[i]]!= b[i]));
		if(!yes)puts("same");
		else puts("diff");
	}
	return 0;
}