#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ll> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

struct SCC
{
	const int INF = int(1e9);
	vector<vector<int> > vec;
	int index;
	vector<int> idx;
	vector<int> lowlink;
	vector<bool> onstack;
	stack<int> s;
	vector<int> sccidx;
	int scccnt;
	vi topo;
	
	//lower sccidx means appear later
	void init(int n)
	{
		idx.assign(n,-1);
		index = 0;
		onstack.assign(n,0);
		lowlink.assign(n,INF);
		while(!s.empty()) s.pop();
		sccidx.assign(n,-1);
		scccnt = 0;
		vec.clear();
		topo.clear();
		vec.resize(n);
	}
	
	void addedge(int u, int v) //u -> v
	{
		vec[u].pb(v);
	}
	
	void connect(int u)
	{
		idx[u] = index;
		lowlink[u] = index;
		index++;
		s.push(u);
		onstack[u] = true;
		for(int i = 0; i < vec[u].size(); i++)
		{
			int v = vec[u][i];
			if(idx[v] == -1)
			{
				connect(v);
				lowlink[u] = min(lowlink[u], lowlink[v]);
			}
			else if(onstack[v])
			{
				lowlink[u] = min(lowlink[u], idx[v]);
			}
		}
		if(lowlink[u] == idx[u])
		{
			while(1)
			{
				int v = s.top();
				s.pop();
				onstack[v] = false;
				sccidx[v] = scccnt;
				if(v == u) break;
			}
			scccnt++;
		}
	}
	
	void tarjan()
	{
		for(int i = 0; i < vec.size(); i++)
		{
			if(idx[i] == -1)
			{
				connect(i);
			}
		}
	}
	
	void toposort() //if graph is a DAG and i just want to toposort
	{
		tarjan();
		int n = vec.size();
		topo.resize(n);
		vector<ii> tmp;
		for(int i = 0; i < n; i++)
		{
			tmp.pb(mp(sccidx[i],i));
		}
		sort(tmp.begin(),tmp.end());
		reverse(tmp.begin(),tmp.end());
		for(int i = 0; i < n; i++)
		{
			topo[i]=tmp[i].se;
			if(i>0) assert(tmp[i].fi!=tmp[i-1].fi);
		}
	}
};
typedef bitset<1001> b100;

map<ii,int> ma;
vector<ii> adj[1111];
int ans[222222];
int mxscc=0;
vector<ii> edges;
vi G[1111];
vector<ii> E[1111];
int siz[1111];
vi ADJ[1111];
void computeE(int sccid)
{
	vi coord;
	for(int i=0;i<G[sccid].size();i++)
	{
		int lab=G[sccid][i];
		int u=edges[lab].fi; int v=edges[lab].se;
		coord.pb(u); coord.pb(v);
		E[sccid].pb({u,v});
	}
	sort(coord.begin(),coord.end()); coord.erase(unique(coord.begin(),coord.end()),coord.end());
	for(int i=0;i<E[sccid].size();i++)
	{
		E[sccid][i].fi=lower_bound(coord.begin(),coord.end(),E[sccid][i].fi)-coord.begin();
		E[sccid][i].se=lower_bound(coord.begin(),coord.end(),E[sccid][i].se)-coord.begin();
	}
	siz[sccid]=coord.size();
}
void check_edge(int n, int sccid, int id)
{
	if(id>200000)
	{
		SCC scc; scc.init(siz[sccid]);
		for(int i=0;i<E[sccid].size();i++)
		{
			if(G[sccid][i]==id) scc.addedge(E[sccid][i].se,E[sccid][i].fi);
			else scc.addedge(E[sccid][i].fi,E[sccid][i].se);
		}
		scc.tarjan();
		assert(scc.scccnt==1);
		return ;
	}
	int u=edges[id].fi; int vv=edges[id].se;
	queue<int> q;
	b100 visited;
	q.push(u); visited.set(u,1);
	while(!q.empty())
	{
		int x=q.front(); q.pop();
		if(visited[vv]) return ;
		for(int v:ADJ[x])
		{
			if(x==u&&v==vv) continue;
			if(!visited[v])
			{
				visited.set(v,1); q.push(v);
			}
		}
	}
	if(!visited[vv]) ans[id]=1;
}

bool visited[1111];
int h[1111];
int par[1111];
vector<ii> T[1111];
vi important;
ii backedge[1111];
void dfs(int u)
{
	visited[u]=1;
	for(ii x:T[u])
	{
		int v=x.fi;
		if(!visited[v])
		{
			h[v]=h[u]+1; par[v]=u;
			important.pb(x.se);
			dfs(v);
		}
	}
}

void solve_scc(int n, int id)
{
	if(G[id].empty()) return ;
	important.clear();
	memset(visited,0,sizeof(visited));
	for(int i=0;i<n;i++)
	{
		T[i].clear();
	}
	int r=-1;
	for(int x:G[id])
	{
		T[edges[x].fi].pb(mp(edges[x].se,x));
		r=edges[x].fi;
	}
	dfs(r);
	memset(visited,0,sizeof(visited));
	for(int i=0;i<n;i++)
	{
		T[i].clear();
	}
	for(int x:G[id])
	{
		T[edges[x].se].pb(mp(edges[x].fi,x));
	}
	dfs(r);
	/*
	int cur=847;
	while(cur!=-1)
	{
		cerr<<cur<<"("<<h[cur]<<") ";
		cur=par[cur];
	}
	cerr<<'\n';
	cerr<<h[534]<<' '<<h[847]<<' '<<backedge[534].fi<<' '<<h[backedge[534].fi]<<'\n';
	for(int i=0;i<n;i++)
	{
		if(backedge[i].fi!=-1) important.pb(backedge[i].se);
	}
	*/
	/*
	computeE(id);
	check_edge(n,id,200001);
	*/
	//assert(important.size()<=2*siz[id]);
	for(int x:important)
	{
		//if(x==144969){cerr<<"YES\n";}
		check_edge(n,id,x);
	}
}
b100 reach[1111];
map<ii,int> CNT;
b100 reach2[1111];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	//freopen("sep2_0.in","r",stdin); freopen("sep2_0.out","w",stdout);
	int n,m; cin>>n>>m;
	SCC scc; scc.init(n);
	for(int i=0;i<m;i++)
	{
		int u,v; cin>>u>>v; u--; v--;
		scc.addedge(u,v);
		ADJ[u].pb(v);
		ma[mp(u,v)]=i;
		edges.pb({u,v});
	}
	scc.tarjan();
	for(int i=0;i<n;i++)
	{
		mxscc=max(mxscc,scc.sccidx[i]);
	}
	vector<int> candidates;
	for(int i=0;i<m;i++)
	{
		int u=edges[i].fi; int v=edges[i].se;
		int l = scc.sccidx[u];
		int r = scc.sccidx[v];
		if(l!=r)
		{
			adj[l].pb(mp(r,i));
			CNT[mp(l,r)]++;
		}
		else
		{
			G[l].pb(i);
		}
	}
	for(int i=0;i<n;i++)
	{
		for(ii x:adj[i])
		{
			int v=x.fi; int lab=x.se;
			if(CNT[mp(i,v)]>1)
			{
				ans[lab]=1;
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		reach[i].set(i,1);
	}
	for(int i=0;i<n;i++)
	{
		for(ii x:adj[i])
		{
			int v=x.fi; int lab=x.se;
			reach[i]|=reach[v];
		}
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(reach[i][j])
			{
				reach2[j].set(i,1);
			}
		}
		reach[i].set(i,0); reach2[i].set(i,0);
	}
	for(int i=0;i<n;i++)
	{
		for(ii x:adj[i])
		{
			int v=x.fi; int lab=x.se;
			if(CNT[mp(i,v)]==1)
			{
				if((reach[i]&reach2[v]).count()!=0) ans[lab]=1;
			}
		}
	}
	for(int i=0;i<=n;i++)
	{
		solve_scc(n,i);
	}
	for(int i=0;i<m;i++)
	{
		cout<<(ans[i]?"diff":"same")<<'\n';
	}
}


Measured memory_bytes: 34548