// 19:17 - 
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define lch (o << 1)
#define rch (o << 1 | 1)

typedef double db;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> pint;

const int N = 1000 + 5;
const int M = 2e5 + 5;
const int INF = 0x3f3f3f3f;
const ll INF_LL = 0x3f3f3f3f3f3f3f3f;

struct Adj{
	int v, id;
};
vector<Adj> a[N];

void DFS(int u, int ban, int eid, int vst[]){
	if(u == ban || vst[u]) return;
	vst[u] = eid;
	for(auto e: a[u])
		DFS(e.v, ban, eid, vst);
}

int vst[2][N];
bool g[N][N], ok[M];

int main(){
	ios::sync_with_stdio(0);

	int n, m;
	cin >> n >> m;
	
	static pint edg[M];
	for(int i=1; i<=m; i++){
		int u, v; cin >> u >> v;
		a[u].push_back((Adj){v, i});
		edg[i] = make_pair(u, v);
	}

	for(int i=1; i<=n; i++){
		memset(vst, 0, sizeof(vst));
		for(auto e: a[i])
			DFS(e.v, i, e.id, vst[0]);
		reverse(a[i].begin(), a[i].end());
		for(auto e: a[i]){
			DFS(e.v, i, e.id, vst[1]);
			if(vst[0][e.v] != vst[1][e.v])
				ok[e.id] = 1;
		}
		for(int j=1; j<=n; j++)
			if(vst[0][j])
				g[i][j] = 1;
	}

	for(int i=1; i<=m; i++){
		int u = edg[i].fi, v = edg[i].se;
		if(ok[i] ^ g[v][u]) cout << "diff\n";
		else cout << "same\n";
	}

	return 0;
}