#include<cstdio>
#include<algorithm>
#include<queue>
#include<map>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<set>
#include<unordered_map>
#include<vector>
typedef long long ll;
using namespace std;
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define N 1010
#define M 200010
vector<int>G[N];
int a[M],b[M],vis[2][N][N];
void dfs(int mod,int a,int b,int col){
	if(vis[mod][a][b])return;
	vis[mod][a][b]=col;
	for(auto q:G[b])dfs(mod,a,q,col);
}
int main(){
	int i,j,n,m;
	scanf("%d%d",&n,&m);
	for(i=1;i<=m;i++){
		scanf("%d%d",&a[i],&b[i]);
		G[a[i]].pb(b[i]);
	}
	for(i=1;i<=n;i++){
		vis[0][i][i]=vis[1][i][i]=1;
		for(j=0;j<G[i].size();j++)dfs(0,i,G[i][j],j+1);
		for(j=G[i].size()-1;j>=0;j--)dfs(1,i,G[i][j],j+1);
	}
	for(i=1;i<=m;i++){
		int x=(vis[0][a[i]][b[i]]!=vis[1][a[i]][b[i]]);
		int y=vis[0][b[i]][a[i]]!=0;
		if(x^y)printf("diff\n");
		else printf("same\n");
	}
	return 0;
}