#include<bits/stdc++.h>
#define fo(i, x, y) for(int i = x, B = y; i <= B; i ++)
#define ff(i, x, y) for(int i = x, B = y; i <  B; i ++)
#define fd(i, x, y) for(int i = x, B = y; i >= B; i --)
#define ll long long
#define pp printf
#define hh pp("\n")
using namespace std;

const int N = 2005;

const int M = 4e5 + 5;

int n, m, x, y;
int fi[N], nt[M], to[M], tot;
vector<int> e[N];

void link(int x, int y) {
	nt[++ tot] = fi[x], to[tot] = y, fi[x] = tot;
	e[x].push_back(y);
}

int bz[N];

int b[N][N];

int d[N], d0, ky[N][N];

void dfs(int x) {
	if(bz[x]) return;
	bz[x] = 1;
	ff(i, 0, e[x].size()) dfs(e[x][i]);
}

#define mem(a) memset(a, 0, sizeof a)

int ans[M];

int main() {
	scanf("%d %d", &n, &m);
	fo(i, 1, m) {
		scanf("%d %d", &x, &y);
		link(x, y);
	}
	fo(st, 1, n) {
		mem(bz); d0 = 0;
		for(int i = fi[st]; i; i = nt[i])
			d[++ d0] = to[i];
		bz[st] = 1;
		fo(i, 1, d0) {
			ky[st][d[i]] |= bz[d[i]];
			dfs(d[i]);
		}
		fo(j, 1, n) b[st][j] |= bz[j];
		mem(bz); bz[st] = 1;
		fd(i, d0, 1) {
			ky[st][d[i]] |= bz[d[i]];
			dfs(d[i]);
		}
		fo(j, 1, n) b[st][j] |= bz[j];
	}
	fo(st, 1, n) {
		for(int i = fi[st]; i; i = nt[i])
			ans[i] = b[to[i]][st] ^ ky[st][to[i]];
	}
	fo(i, 1, m) pp("%s\n", ans[i] ? "diff" : "same");
}