#include<bits/extc++.h>
#include<bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector,O3")
using namespace std;using ll = long long;using ull = unsigned long long;using ul = unsigned;using db = double;using __gnu_pbds::null_type;
#ifdef _debug 
#define dout(i) cout << #i << ' ' << i << ' '
#else 
#define dout(i) 0&&0
#endif
#define eout(i) {cout << (i) << '\n';exit(0);}
#define priority_queue __gnu_pbds::priority_queue
#define unordered_map __gnu_pbds::gp_hash_table
#define rep(a, b) {for(int i = a;i > 0;--i){b;}}
#define multe int T;for(cin >> T;T--;)
pair<long long, long long> ext_gcd(long long a, long long b){if(a % b == 0)return {0ll, 1ll};auto get = ext_gcd(b, a % b);return {get.second, get.first - a / b * get.second};} long long ext_inv(long long a, long long p){return (ext_gcd(a, p).first + p) % p;} template<typename T> using rbtree = __gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>; template<typename T> inline long long pow(long long v, long long t, const T &p){long long res = 1;for(;t;t >>= 1, v = v * v % p)if(t & 1)res = res * v % p;return res;} template<typename T> inline void floyd_warshall(vector<vector<T>> &dp){for(int i = 0;i < dp.size();++i)for(int j = 0;j < dp.size();++j)for(int k = 0;k < dp.size();++k)dp[i][k] = min(dp[i][k], dp[i][j] + dp[j][k]);} template<typename T> inline ostream& operator << (ostream &ou, const vector<T> &a){for(auto it = a.begin();it != a.end();++it)ou << (it != a.begin() ? " " : "") << *it;return ou;} template<typename T> inline vector<vector<T>> operator * (const vector<vector<T>> &a, const vector<vector<T>> &b){assert(a.front().size() == b.size());vector<vector<T>> res(a.size(), vector<T>(b.front().size()));for(int i = 0;i < a.size();++i)for(int j = 0;j < b.front().size();++j)for(int k = 0;k < a.front().size();++k)res[i][j] += a[i][k] * b[k][j];return res;} template<typename T> inline vector<vector<T>> pow(vector<vector<T>> v, long long t){vector<vector<T>> res;for(;t;t >>= 1, v = v * v)if(t & 1)res = (res.empty() ? v : res * v);return res;} template<typename T> void read(int n, T *s){while(n--)cin >> *s, ++s;} template<typename T> void read(int n, vector<T> &v){for(int i = 0;i < n;++i)cin >> v[i];} template<typename T> void write(int n, T *s){while(n--)cout << *s << " \n"[n==0], ++s;} template<typename T1, typename T2>inline istream& operator >> (istream &in, pair<T1, T2> &a){return in >> a.first >> a.second;} template<typename T1, typename T2>inline ostream& operator << (ostream &ou, const pair<T1, T2> &b){return ou << b.first << ' ' << b.second;} template<typename T1, typename T2>inline pair<T1,T2> operator + (const pair<T1,T2> &a, const pair<T1,T2> &b){return {a.first + b.first, a.second + b.second};} template<typename T1, typename T2>inline pair<T1,T2> operator - (const pair<T1,T2> &a, const pair<T1,T2> &b){return {a.first - b.first, a.second - b.second};} template<typename T1, typename T2>inline long long operator ^ (const pair<T1,T2> &a, const pair<T1,T2> &b){return (long long)a.first * b.second - (long long)a.second * b.first;} 
const int maxn = 1001;
string out[2]{"same\n", "diff\n"};
int res[maxn * maxn];
int n, m;
vector<pair<int,int>> edge[maxn], rev[maxn];
bool vis[maxn];
int togo[maxn], tl;
void bfs(const int &now){
	memset(vis, 0, sizeof vis);
	tl = 1, togo[0] = now, vis[now] = true;
	for(int i = 0;i < tl;++i){
		for(const auto &j : edge[togo[i]])if(!vis[j.second]){
			vis[j.second] = true;
			togo[tl++] = j.second;
		}
	}
}
void getpath(const int &now, int *v, const int &id, const int &block){
	tl = 1, togo[0] = now;
	for(int i = 0;i < tl;++i){
		for(const auto &j : edge[togo[i]])if(j.second != block and !v[j.second]){
			v[j.second] = id;
			togo[tl++] = j.second;
		}
	}
}
int sid[maxn], bid[maxn];
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n >> m;
	for(int i = 0, a, b;i < m;++i){
		cin >> a >> b;
		edge[a].emplace_back(i+1, b);
		rev[b].emplace_back(i+1, a);
	}	
	for(int i = 1;i <= n;++i){
		bfs(i);
		for(auto &j : rev[i])res[j.first] ^= (bool)vis[j.second];
		memset(sid, 0, sizeof sid), memset(bid, 0, sizeof bid);
		for(int j = 0;j < (int)edge[i].size();++j)getpath(edge[i][j].second, sid, edge[i][j].first, i);
		for(int j = (int)edge[i].size()-1;j > -1;--j)getpath(edge[i][j].second, bid, edge[i][j].first, i);
		for(auto &j : edge[i])res[j.first] ^= ((sid[j.second] and sid[j.second] != j.first) || (bid[j.second] and bid[j.second] != j.first));
	}
	for(int i = 1;i <= m;++i)cout << out[res[i]&1];
}

Measured memory_bytes: 8192