#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int N=1005;
const int M=200005;
vector<int> e[N];
int head[N],tot;
int n,m,x[M],y[M];
int co1[N][N],co2[N][N];
int vis[N],q[N];
void dfs(int x,int co){
	vis[x]=co;
	for (auto i:e[x]) if (!vis[i]) dfs(i,co);
}
int main(){
	scanf("%d%d",&n,&m);
	For(i,1,m){
		scanf("%d%d",&x[i],&y[i]);
		e[x[i]].PB(y[i]);
	}
	For(i,1,n){
		*q=0;
		for (auto j:e[i]) q[++*q]=j;
		For(j,1,n) vis[j]=(j==i?-1:0);
		For(j,1,*q) if (!vis[q[j]]) dfs(q[j],q[j]);
		For(j,1,n) co1[i][j]=vis[j];
		For(j,1,n) vis[j]=(j==i?-1:0);
		Rep(j,*q,1) if (!vis[q[j]]) dfs(q[j],q[j]);
		For(j,1,n) co2[i][j]=vis[j];
	}
	For(i,1,m){
		bool f1=(co1[y[i]][x[i]]!=0);
		bool f2=(co2[x[i]][y[i]]&&co2[x[i]][y[i]]!=y[i])||
				(co1[x[i]][y[i]]&&co1[x[i]][y[i]]!=y[i]);
		puts(f1^f2?"diff":"same");
	}
}