#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
const long double inf = 2e18;
const int N = 1020;
const int maxn = 200020;
const long long mod = 998244353;
struct node {
  int next, to;
} e[maxn * 2];
int head[maxn], cnt;
int reach[N][N], vis[N], tag[N];
int n, m;
vector<pair<int, int> > edge;
inline void adde(int x, int y) {
  e[++cnt].to = y;
  e[cnt].next = head[x];
  head[x] = cnt;
}
void dfs(int x, int from) {
  if (vis[x] >= 2) return;
  if (!vis[x])
    vis[x] = 1, tag[x] = from;
  else {
    if (from != tag[x])
      vis[x]++;
    else
      return;
    if (vis[x] > 2) return;
  }
  for (register int i = head[x]; i; i = e[i].next) {
    dfs(e[i].to, from);
  }
}
void solve(int id) {
  for (register int i = 1; i <= n; i++) vis[i] = 0;
  vis[id] = n;
  for (register int i = head[id]; i; i = e[i].next) {
    dfs(e[i].to, e[i].to);
  }
  for (register int i = 1; i <= n; i++) {
    reach[id][i] = vis[i];
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (register int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    adde(x, y);
    edge.push_back(make_pair(x, y));
  }
  for (register int i = 1; i <= n; i++) solve(i);
  for (register int i = 0; i <= m - 1; i++) {
    int x = edge[i].first, y = edge[i].second;
    if (reach[x][y] > 1 && reach[y][x])
      puts("same");
    else if (reach[x][y] == 1 && !reach[y][x])
      puts("same");
    else
      puts("diff");
  }
}
