#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N, M, A[202020], B[202020];
vector<int> graph[1010], eid[1010];

bool conn[1010][1010];
bool vis[1010];
bool sol[202020];

void dfs(int q, int src)
{
	if (conn[src][q]) return;
	conn[src][q] = true;
	for (int r : graph[q]) dfs(r, src);
}

pair<int, int> orig[1010];

void visit(int p, int ec, int ori)
{
	if (p == ori) return;
	if (orig[p].second != -1) return;
	if (orig[p].first == ec) return;
	
	if (orig[p].first != -1) orig[p].second = ec;
	else orig[p].first = ec;

	for (int q : graph[p]) visit(q, ec, ori);
}

int main()
{
	scanf("%d%d", &N, &M);
	for (int i = 0; i < M; ++i) {
		scanf("%d%d", A + i, B + i);
		--A[i]; --B[i];
	}
	for (int i = 0; i < M; ++i) {
		graph[A[i]].push_back(B[i]);
		eid[A[i]].push_back(i);
	}
	for (int i = 0; i < N; ++i) dfs(i, i);

	for (int i = 0; i < N; ++i) {
		fill(orig, orig + N, make_pair(-1, -1));

		for (int j : graph[i]) visit(j, j, i);

		for (int j_ = 0; j_ < graph[i].size(); ++j_) {
			int ei = eid[i][j_], j = graph[i][j_];

			bool ab = orig[j].second != -1;
			bool ba = conn[j][i];
			sol[ei] = (ab == ba);
		}
	}

	for (int i = 0; i < M; ++i) {
		puts(sol[i] ? "same" : "diff");
	}
	return 0;
}
