#include<bits/stdc++.h>
#define For(i,l,r) for(int i = (l),i##end = (r);i <= i##end;i++)
#define Fordown(i,r,l) for(int i = (r),i##end = (l);i >= i##end;i--)
#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long ll;

template <typename T> inline bool chkmin(T &x,T y) { return y < x ? x = y,1 : 0; }
template <typename T> inline bool chkmax(T &x,T y) { return x < y ? x = y,1 : 0; }

const int INF = 0x3f3f3f3f;
const int N = 1e3 + 10,M = 2e5 + 10;

struct node {
	int x,y;
}G[M];
int to[M],nex[M],beg[N],cnt[N][N],vis[N];
vector <int> Graph[N];
int e,n,m;

inline int read() {
	int x = 0,flag = 1;
	char ch = getchar();
	while(!isdigit(ch) && ch != '-')ch = getchar();
	if(ch == '-')flag = -1,ch = getchar();
	while(isdigit(ch))x = (x << 3) + (x << 1) + (ch - '0'),ch = getchar();
	return x * flag;
}

inline void add(int x,int y) {
	to[++e] = y,nex[e] = beg[x],beg[x] = e;
}

void dfs(int St,int cur,int To) {
	if(St == cur || vis[cur] == To || cnt[St][cur] >= 2) return;
	if(++cnt[St][cur] == 1) vis[cur] = To;
	For(i,0,Graph[cur].size() - 1) dfs(St,Graph[cur][i],To);
}

int main() {
	n = read(),m = read();
	For(i,1,m) {
		int x = read(),y = read();
		G[i] = (node){x,y};
		Graph[x].push_back(y);
	}

	For(i,1,n) {
		memset(vis,0,sizeof(vis));
		For(j,0,Graph[i].size() - 1) dfs(i,Graph[i][j],Graph[i][j]);
	}

	For(i,1,m) {
		if((cnt[G[i].x][G[i].y] >= 2) ^ (cnt[G[i].y][G[i].x] >= 1)) puts("diff");
		else puts("same");
	}
	return 0;
}