#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 998244353;

int n, m;
int u[200005], v[200005];
vector<int> G[1005];
int arr[1005][1005];

void dfs(int x, int y, int tp)
{
	arr[x][y] = arr[x][y] ? -1 : tp;
	rep(i, G[y].size()) {
		int cy = G[y][i];
		if(arr[x][cy] != -1 && arr[x][cy] != tp) dfs(x, cy, tp);
	}
}

int main()
{
	scanf("%d%d", &n, &m);
	rep(i, m) {
		scanf("%d%d", &u[i], &v[i]);
		G[u[i]].push_back(v[i]);
	}
	
	rep1(i, n) arr[i][i] = -1;
	rep(i, m) dfs(u[i], v[i], v[i]);

	rep(i, m) {
		if((arr[u[i]][v[i]] != v[i]) != (arr[v[i]][u[i]] != 0)) printf("diff\n");
		else printf("same\n");
	}
	return 0;
}