#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1005,M=200005,p=1000000007;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int n,m,ans[M];
bitset<N> h,a[N];
vector< pair<int,int> > e[N];
void work(int x){
	h[x]=1;
	for (auto t : e[x])
	if (!h[t.first]) work(t.first);
}
int main(){
	n=read();m=read();
	for (int i=1;i<=m;i++){
		int u=read(),v=read();
		e[u].push_back(make_pair(v,i));
	}
	for (int x=1;x<=n;x++){
		h.reset();h[x]=1;
		for (auto t : e[x]){
			int y=t.first;
			if (h[y]) ans[t.second]=1;
			else work(y);
		}
		a[x]|=h;
		h.reset();h[x]=1;
		reverse(e[x].begin(),e[x].end());
		for (auto t : e[x]){
			int y=t.first;
			if (h[y]) ans[t.second]=1;
			else work(y);
		}
	}
	for (int x=1;x<=n;x++)
	for (auto t : e[x]){
		int y=t.first,i=t.second;
		ans[i]^=a[y][x];
	}
	for (int i=1;i<=m;i++) puts(ans[i] ? "diff" : "same");
	return 0;
}