#include<bits/stdc++.h>
using namespace std;

const int N = 1010, M = 200010;

template <class T>
void read (T &x) {
	int sgn = 1;
	char ch;
	x = 0;
	for (ch = getchar(); (ch < '0' || ch > '9') && ch != '-'; ch = getchar()) ;
	if (ch == '-') ch = getchar(), sgn = -1;
	for (; '0' <= ch && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
	x *= sgn;
}


int n, m, fr[M], to[M], nxt[M], tt, s, t, id[N], h[N];
bool vis[N][N], can[M];
vector<int> E[N];

void addedge (int u,int v) {
	fr[++tt] = u, to[tt] = v;
	nxt[tt] = h[u], h[u] = tt;
	E[u].push_back(v);
}

void dfs (int u) {
	vis[s][u] = true;
	if (id[u]) return;
	id[u] = t;
	for (auto v : E[u]) {
		if(!id[v] && v != s) dfs(v);
	}
}

int main () {
	cin >> n >> m;
	for(int i = 1, u, v; i <= m; i++) read(u), read(v), addedge(u,v);
	
	for(s = 1; s <= n; s++) {
		memset(id, 0, sizeof(id));
		vector<int> son;

		for(int i = h[s], v; v = to[i], i; i=nxt[i]) son.push_back(v), dfs(t = v);
		reverse(son.begin(),son.end());
		for(int i = h[s], v; v = to[i], i; i=nxt[i]) {
			if(id[v] != v) can[i] = 1;
		}

		memset(id, 0, sizeof(id));
		for(auto v : son) dfs(t = v);
		for(int i = h[s], v; v = to[i], i; i = nxt[i]) {
			if(id[v] != v) can[i] = 1;
		}
	}

	for(int i = 1; i <= m; i++) {
		int u = fr[i], v = to[i];
		if(can[i] == vis[v][u]) cout << "same\n";
		else cout << "diff\n";
	}
	return 0;
}