#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int MC = 1024;
int N,M;
vector<P2> V[MC];
vector<P2> E;
bool ans[200010];
bool visited[MC];

void dfs(int q){
	visited[q] = 1;
	for(auto u : V[q]){
		if(visited[u.first]) continue;
		dfs(u.first);
	}
}

int main(){
	cin >> N >> M;
	repp(i,0,M){
		int a,b;
		cin >> a >> b;
		V[a].PB(MP(b,i));
		E.PB(MP(a,b));
	}
	repp(i,1,N+1){
		fill(visited,visited+MC,0);
		visited[i] = 1;
		repp(j,0,V[i].size()){
			if(visited[V[i][j].first]) ans[V[i][j].second] = 1;
			else dfs(V[i][j].first);
		}
		fill(visited,visited+MC,0);
		visited[i] = 1;
		repm(j,V[i].size()-1,-1){
			if(visited[V[i][j].first]) ans[V[i][j].second] = 1;
			else dfs(V[i][j].first);
		}
	}
	repp(i,1,N+1){
		fill(visited,visited+MC,0);
		dfs(i);
		repp(j,0,M) if(E[j].second == i && visited[E[j].first]) ans[j] ^= 1;
	}
	repp(i,0,M) cout << (ans[i] ? "diff" : "same") << endl;
	return 0;
}
