#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
vector<int> gr[1010];
int a[252521],b[252521];
int dp[1010][1010];
int from[1010];
void dfs(int v,int r,int s){
	if(v==r) return;
	if(dp[r][v]>=2) return;
	if(dp[r][v]==1 && from[v]==s) return;
	if(dp[r][v]==0) from[v]=s;
	dp[r][v]++;
	//cout<<v<<' '<<r<<' '<<s<<' '<<dp[r][v]<<endl;
	rep(i,gr[v].size()) dfs(gr[v][i],r,s);
}
int main()
{
	int n,m;cin>>n>>m;
	rep(i,m){
		cin>>a[i]>>b[i];a[i]--;b[i]--;
		gr[a[i]].pb(b[i]);//gr[b[i]].pb(a[i]);
	}
	memset(dp,0,sizeof(dp));
	rep(i,n){
		memset(from,-1,sizeof(from));
		rep(j,gr[i].size()) dfs(gr[i][j],i,gr[i][j]);
	}
	rep(i,n){
		//rep(j,n) cout<<i+1<<' '<<j+1<<' '<<dp[i][j]<<endl;
	}
	rep(i,m){
		bool f=(dp[a[i]][b[i]]>=2);
		bool g=(dp[b[i]][a[i]]>=1);
		if(f==g) cout<<"same"<<endl;else cout<<"diff"<<endl;
	}
}
