#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
 
template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=1005;
int mn[N][N],mx[N][N],a[N*200],b[N*200],n,m;
vi e[N];

int vis[N];
void dfs(int u,int id,int from,int f){
	if(vis[u]||u==from)return; vis[u]=1;
	if(f)mx[from][u]=id;
	else mn[from][u]=id;
	for(auto v:e[u])
		if(!vis[v])dfs(v,id,from,f);
}

int main(){
	read(n),read(m);
	rep(i,1,m){
		read(a[i]),read(b[i]);
		e[a[i]].pb(b[i]);
	}
	rep(u,1,n){
		sort(e[u].begin(),e[u].end());
		int sz=e[u].size();
		memset(vis,0,sizeof vis);
		rep(i,0,sz-1)
			dfs(e[u][i],e[u][i],u,0);
		memset(vis,0,sizeof vis);
		per(i,sz-1,0)
			dfs(e[u][i],e[u][i],u,1);
	}
	rep(i,1,m)
		puts((!mx[b[i]][a[i]])==(mn[a[i]][b[i]]!=mx[a[i]][b[i]])
				?"diff":"same");
	return 0;
}