#include <bits/stdc++.h>
using namespace std;
#define M 1010
#define LL long long
#define rep(i, x, y) for(int i = (x); i <= (y); ++ i)
inline int read() {
	char ch = getchar(); int x = 0, f = 1;
	while(ch < '0' || ch > '9') {
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while('0' <= ch && ch <= '9') {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * f;
}
int p[M][M], q[M][M];
int T;
vector<int> G[M];
int vis[M];
inline void dfs(int st, int x, int id, int a[]) {
	if(st == x || vis[x] == T) return;
	vis[x] = T; a[x] = id;
	for(int i = 0; i < G[x].size(); ++ i) {
		dfs(st, G[x][i], id, a);
	}
}
pair<int, int> A[M*200];
int main() {
	//freopen("in.txt", "r", stdin);
	int n = read(), m = read();
	rep(i, 1, m) {
		int u = read(), v = read();
		G[u].push_back(v);
		A[i] = make_pair(u, v);
	}
	rep(i, 1, n) {
		++ T;
		int id = 0;
		for(int j = 0; j < G[i].size(); ++ j) {
			dfs(i, G[i][j], ++ id, p[i]);
		}
		reverse(G[i].begin(), G[i].end());
		++ T; id = G[i].size();
		for(int j = 0; j < G[i].size(); ++ j) {
			dfs(i, G[i][j], id --, q[i]);
		}
	}
	rep(i, 1, m) {
		int u = A[i].first, v = A[i].second;
		if((q[v][u] > 0) == (p[u][v] != q[u][v])) {
			puts("same");
		}
		else puts("diff");
	}
	return 0;
}
