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

const int MAXN = 1010;
const int MAXM = 200010;

struct Edge {
	int u, v;

	Edge() {}
	Edge(int u, int v):u(u), v(v) {}
}E[MAXM];

vector<int>to[MAXN];

int Mark[MAXN];
bitset<MAXN>vis;
bool G1[MAXN][MAXN];
bool G2[MAXN][MAXN];

inline void dfs1(int x, int st) {
	G1[st][x] = 1, vis.set(x);
	for(auto u : to[x]) if(!vis[u]) dfs1(u, st);
}

inline void dfs2(int x, int col, int k, int st) {
	if(k) G2[st][x] = Mark[x] != col;
	else Mark[x] = col; vis.set(x);
	for(auto u : to[x]) if(!vis[u]) dfs2(u, col, k, st);
}

int main() {
	int n, m; scanf("%d%d", &n, &m);
	for(int i = 1; i <= m; i++) {
		int u, v; scanf("%d%d", &u, &v);
		to[u].push_back(v);
		E[i] = Edge(u, v);
	}
	for(int i = 1; i <= n; i++) vis.reset(), dfs1(i, i);
	for(int i = 1; i <= n; i++) {
		vis.reset(), vis.set(i);
		memset(Mark, 0, sizeof(Mark));
		int d = to[i].size();
		for(int j = 0; j < d; j++) if(!vis[to[i][j]]) dfs2(to[i][j], j + 1, 0, i);
		vis.reset(), vis.set(i);
		for(int j = d - 1; ~j; --j) if(!vis[to[i][j]]) dfs2(to[i][j], j + 1, 1, i);
	}
	for(int i = 1; i <= m; i++)
		puts(G1[E[i].v][E[i].u] ^ G2[E[i].u][E[i].v] ? "diff" : "same");
	return 0;
}