// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



namespace SCC {

	const int N = 110000;

	vector<int> con[N], rcon[N];

	int n, vis[N], visT;

	int id[N], idn;

	void init(int nn = 0) {

		n = nn, visT = idn = 0;

		for (int i = 1; i <= n; i++) con[i].clear(), rcon[i].clear();

	}

	void add_edge(int u, int v) {

		con[u].push_back(v);

		rcon[v].push_back(u);

	}

	void dfs(int u) {

		vis[u] = 1;

		for (int v : con[u]) if (!vis[v]) dfs(v);

		id[idn++] = u;

	}

	void rdfs(int u) {

		vis[u] = visT;

		for (int v : rcon[u]) if (!vis[v]) rdfs(v);

	}

	void SCC() {

		for (int i = 1; i <= n; i++) vis[i] = 0;

		for (int i = 1; i <= n; i++) if (!vis[i]) dfs(i);

		for (int i = 1; i <= n; i++) vis[i] = 0;

		for (int i = idn - 1; i >= 0; i--) if (!vis[id[i]]) visT++, rdfs(id[i]);

	}

};



const int N = 1100;

const int M = 220000;



vector<int> con[N];



struct Edge {

	int u, v;

	Edge(int u = 0, int v = 0) : u(u), v(v) {}

} E[M];



int adj[N][N];

int vis[N], visT;

int son[2][N][N];



inline bool Find(int u, int tar) {

	if (adj[u][tar] > 1) return true;

	return son[0][u][tar] != tar || son[1][u][tar] != tar;

}



void dfs(int u, int id, int rt, int __rt) {

	vis[u] = visT;

	son[id][__rt][u] = rt;

	for (int v : con[u]) if (vis[v] != visT) dfs(v, id, rt, __rt);

}



void init(int n) {

	for (int i = 1; i <= n; i++) {

		visT++;

		vis[i] = visT;

		for (int v : con[i]) if (vis[v] != visT) dfs(v, 0, v, i);

		reverse(con[i].begin(), con[i].end());

		visT++;

		vis[i] = visT;

		for (int v : con[i]) if (vis[v] != visT) dfs(v, 1, v, i);

	}

}



int main() {

	

	ios::sync_with_stdio(0);

	cin.tie(0), cout.tie(0);

	

	int n, m; cin >> n >> m;

	SCC::init(n + 10);

	for (int i = 0; i < m; i++) {

		int u, v; cin >> u >> v;

		E[i] = Edge(u, v);

		con[u].push_back(v);

		adj[u][v]++;

		SCC::add_edge(u, v);

	}

	SCC::SCC();

	

	init(n);

	

	for (int i = 0; i < m; i++) {

		auto a = SCC::vis[E[i].u], b = SCC::vis[E[i].v];

		if (a == b) {

			if (Find(E[i].u, E[i].v)) cout << "same\n";

			else cout << "diff\n";

		} else {

			if (Find(E[i].u, E[i].v)) cout << "diff\n";

			else cout << "same\n";

		}

	}

	

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 8.835935991096063x):
#include<iostream>

#include<algorithm>

#include<cstdio>

#include<cstring>

#include<cmath>

#include<vector>

using namespace std;

#define REP(i,a,b) for(register int i=a;i<=b;++i)

#define DREP(i,a,b) for(register int i=a;i>=b;--i)

#define mem(a) memset(a,0,sizeof(a))

inline char get_char(){

	static char buf[1000000],*p1,*p2;

    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;

}

inline int read(){

    int numm=0;

    char _;_=get_char();

    while(_<'0'||_>'9'){_=get_char();} 

    while(_>='0'&&_<='9'){numm=(numm<<3)+(numm<<1)+(_^48);_=get_char();   }

    return numm;

}

const int maxn=1000+10;

const int maxm=200000+10;

vector<int>E[maxn];

int n,m,beg[maxn],len,num[maxn][maxn];

bool can[maxn][maxn],vis[maxn],can1[maxn][maxn];

int vis1[maxn],vis2[maxn],from[maxm],to[maxm];

void dfs(int u,int rt){

	vis[u]=1;

	can[rt][u]=1;

	int size=E[u].size()-1;

	REP(i,0,size){

		int v=E[u][i];

		if(vis[v])continue;

		dfs(v,rt);

	}

}

void dfs1(int u){

	vis[u]=1;

	int size=E[u].size()-1;

	REP(i,0,size){

		int v=E[u][i];

		if(vis[v])continue;

		vis1[v]=num[u][v];

		dfs1(v);

	}

}

void dfs2(int u){

	vis[u]=1;

	int size=E[u].size()-1;

	DREP(i,size,0){

		int v=E[u][i];

		if(vis[v])continue;

		vis2[v]=num[u][v];

		dfs2(v);

	}

}

int main(){

//	freopen("test.txt","r",stdin);

	n=read();m=read();

	REP(i,1,m){

		int u,v;

		u=read();v=read();

		E[u].push_back(v);

		num[u][v]=++len;

		from[len]=u;

		to[len]=v;

	}

	REP(i,1,n){

		dfs(i,i);

		mem(vis);

	}

	REP(i,1,n){

		dfs1(i);

		mem(vis);

		dfs2(i);

		mem(vis);

		int size=E[i].size()-1;

		REP(j,0,size){

			int v=E[i][j];

			if(vis1[v]!=num[i][v] || vis2[v]!=num[i][v])

				can1[i][v]=1;

		}

		mem(vis1);

		mem(vis2);

	}

	REP(i,1,m){

		int u=from[i],v=to[i];

		if((can[v][u]^can1[u][v])==0)

			puts("same");

		else puts("diff");

	}

	return 0;

}