#include<bits/stdc++.h>
using namespace std;

int a[200001],b[200001];
bool reachable[1001][1001];
bool visit[1001];
vector<pair<int,int> > edge[1001];

void dfs(int x){
	visit[x]=true;
	for(auto it:edge[x])
		if(!visit[it.first])
			dfs(it.first);
}

int minmark[1001][1001],maxmark[1001][1001];
void dfs2(int from,int x,int stp){
	minmark[from][x]=stp;
	for(int i=0;i<edge[x].size();i++)
		if(!minmark[from][edge[x][i].first])
			dfs2(from,edge[x][i].first,stp);
}
void dfs3(int from,int x,int stp){
	maxmark[from][x]=stp;
	for(int i=edge[x].size()-1;i>=0;i--)
		if(!maxmark[from][edge[x][i].first])
			dfs3(from,edge[x][i].first,stp);
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>a[i]>>b[i];
		edge[a[i]].emplace_back(make_pair(b[i],i));
	}
	for(int i=1;i<=n;i++){
		memset(visit,0,sizeof visit);
		dfs(i);
		for(int j=1;j<=n;j++)
			reachable[i][j]=visit[j];
	}
	for(int i=1;i<=n;i++){
		minmark[i][i]=-1;
		for(int j=0;j<edge[i].size();j++)
			if(!minmark[i][edge[i][j].first])
				dfs2(i,edge[i][j].first,edge[i][j].second);
	}
	for(int i=1;i<=n;i++){
		maxmark[i][i]=-1;
		for(int j=edge[i].size()-1;j>=0;j--)
			if(!maxmark[i][edge[i][j].first])
				dfs3(i,edge[i][j].first,edge[i][j].second);
	}
	for(int i=1;i<=m;i++){
		if(reachable[b[i]][a[i]]){
			if((minmark[a[i]][b[i]]==i||minmark[a[i]][b[i]]==0)&&(maxmark[a[i]][b[i]]==i||maxmark[a[i]][b[i]]==0))
				cout<<"diff"<<'\n';
			else
				cout<<"same"<<'\n';
		}
		else{
			if((minmark[a[i]][b[i]]==i||minmark[a[i]][b[i]]==0)&&(maxmark[a[i]][b[i]]==i||maxmark[a[i]][b[i]]==0))
				cout<<"same"<<'\n';
			else
				cout<<"diff"<<'\n';
		}
	}
}
