#include <bits/stdc++.h>

using bstype = std::bitset<1000>;
int vis[1000];
bstype bs[1000];
bstype bs2[1000];
bstype bs3[1000];
std::pair<int,int> p[200003];
int n,m;
int q[1000],qa,qb;
int vis1[1000],vis2[1000];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i = 0;i < m;++i) {
		int a,b;
		scanf("%d%d",&a,&b);--a,--b;
		p[i].first = a;p[i].second = b;
		bs[a][b] = 1;
	}
	for(int i = 0;i < n;++i) {
		q[0] = i;qa = 0;qb = 1;bs2[i][i] = 1;
		while(qa < qb) {
			int cur = q[qa++];
			bstype nex = ~bs2[i]&bs[cur];
			bs2[i] |= nex;
			for(int j = 0;j < n;++j) if(nex[j]) q[qb++] = j;
		}
	}
	// 0->2?
	for(int i = 0;i < n;++i) {
		memset(vis1,-1,sizeof(vis1));
		memset(vis2,-1,sizeof(vis2));
		bstype v1, v2;
		for(int j = 0;j < n;++j) if(bs[i][j] && vis1[j] == -1) {
			q[0] = j;qa = 0;qb = 1;vis1[j] = j;v1[i] = v1[j] = true;
			while(qa < qb) {
				int cur = q[qa++];
				bstype res = ~v1&bs[cur];
				v1 |= res;
				for(int k = 0;k < n;++k) if(res[k]) {
					vis1[k] = j;
					q[qb++] = k;
				}
			}
		}
		for(int j = n-1;j >= 0;--j) if(bs[i][j] && vis2[j] == -1) {
			q[0] = j;qa = 0;qb = 1;vis2[j] = j;v2[i] = v2[j] = true;
			while(qa < qb) {
				int cur = q[qa++];
				bstype res = ~v2&bs[cur];
				v2 |= res;
				for(int k = 0;k < n;++k) if(res[k]) {
					vis2[k] = j;
					q[qb++] = k;
				}
			}
		}
		for(int j = 0;j < n;++j) if(vis1[j] != vis2[j]) bs3[i][j] = 1;
	}
	for(int i = 0;i < m;++i) {
		int a = p[i].first, b = p[i].second;
		if(bs2[b][a] == bs3[a][b]) {
			printf("same\n");
		} else {
			printf("diff\n");
		}
	}
}
