#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second
 
vector<int> e[1010];
int n, m;
 
int fr[200010];
int to[200010];
char gyaku[200010];
 
bitset<1001> reach[1001], todo;
queue<int> q;
 
void F(int x){
	todo.reset();
	auto& v = e[x];
	int s = v.size();
	for(int i=0; i<s; ++i){
		int y = to[v[i]];
		if(todo[y]){
			gyaku[v[i]] = 1;
		} else {
			q.push(y);
			todo[y]=1;
			while(q.size()){
				int a=q.front(); q.pop();
				for(int ei:e[a]){
					int b=to[ei];
					if(b == x || todo[b]) continue;
					todo[b]=1; q.push(b);
				}
			}
		}
	}
	reach[x] = todo;
	todo.reset();
	for(int i=s-1; 0<=i; --i){
		int y = to[v[i]];
		if(todo[y]){
			gyaku[v[i]] = 1;
		} else {
			q.push(y);
			todo[y]=1;
			while(q.size()){
				int a=q.front(); q.pop();
				for(int ei:e[a]){
					int b=to[ei];
					if(b == x || todo[b]) continue;
					todo[b]=1; q.push(b);
				}
			}
		}
	}
}
 
int main()
{
	read(n, m);
	for(int i=1; i<=m; ++i){
		int a, b; read(a, b);
		fr[i] = a; to[i] = b;
		e[a].pb(i);
	}
	for(int i=1; i<=n; ++i) F(i);
	
	for(int i=1; i<=m; ++i){
		if(gyaku[i] != reach[to[i]][fr[i]]){
			puts("diff");
		} else {
			puts("same");
		}
	}
	return 0;
}