#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long linf = 1ll * inf * inf;
const int N = 1000 + 7;
const int M = 20;
const int multipleTest = 0;
int ways[N][N];
int n, m;
vector<pair<int, int> > edge;
class StrComp {
 public:
  int num[N], low[N];
  int cs[N];
  vector<int> adj[N];
  int cnt = 0;
  int comps = 0;
  bitset<N> go[N];
  vector<int> rev[N];
  int tIn[N];
  set<int> nxt;
  int dp[N];
  void init(int r) {
    for (int i = (1), _b = (n + 1); i < _b; ++i) {
      num[i] = low[i] = cs[i] = 0;
      adj[i].clear();
      go[i].reset();
      rev[i].clear();
      tIn[i] = 0;
      dp[i] = 0;
    }
    cnt = comps = 0;
    nxt.clear();
    for (pair<int, int> e : edge) {
      if (e.first != r && e.second != r) {
        adj[e.first].push_back(e.second);
      } else if (e.first == r) {
        nxt.insert(e.second);
      }
    }
    for (int i = 1; i <= n; ++i)
      if (!num[i]) {
        dfs(i);
      }
    if (!r || nxt.size() <= 1) return;
    for (pair<int, int> e : edge) {
      if (e.first != r && e.second != r) {
        if (cs[e.first] != cs[e.second]) {
          int u = cs[e.first], v = cs[e.second];
          if (!go[u][v]) {
            go[u].set(v);
            rev[u].push_back(v);
            ++tIn[v];
          }
        }
      }
    }
    for (int v : nxt) dp[cs[v]]++;
    static int q[N], bot, top;
    bot = top = 0;
    for (int i = 1; i <= comps; ++i)
      if (!tIn[i]) q[top++] = i;
    while (bot < top) {
      int u = q[bot++];
      for (int v : rev[u]) {
        tIn[v]--;
        dp[v] += dp[u];
        if (!tIn[v]) {
          q[top++] = v;
        }
      }
    }
    for (int v : nxt)
      if (dp[cs[v]] > 1) ways[r][v] = true;
  }
  void dfs(int u) {
    static stack<int> stk;
    low[u] = num[u] = ++cnt;
    stk.push(u);
    for (int v : adj[u]) {
      if (cs[v]) continue;
      if (!num[v]) {
        dfs(v);
        low[u] = min(low[u], low[v]);
      } else {
        low[u] = min(low[u], num[v]);
      }
    }
    if (low[u] == num[u]) {
      cs[u] = ++comps;
      while (stk.top() != u) {
        cs[stk.top()] = comps;
        stk.pop();
      }
      assert(!stk.empty() && stk.top() == u);
      stk.pop();
    }
  }
} st;
bool can[N][N];
int root;
vector<int> adj[N];
void dfs(int u) {
  can[root][u] = true;
  for (int v : adj[u]) {
    if (can[root][v]) continue;
    dfs(v);
  }
}
void solve() {
  cin >> n >> m;
  memset(ways, 0, sizeof(ways));
  for (int i = (0), _b = (m); i < _b; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    edge.push_back({u, v});
    adj[u].push_back(v);
  }
  for (int i = 1; i <= n; ++i) st.init(i);
  for (int i = 1; i <= n; ++i) {
    root = i;
    dfs(i);
  }
  for (pair<int, int> e : edge) {
    int u = e.first;
    int v = e.second;
    if (can[v][u]) {
      if (ways[u][v])
        puts("same");
      else
        puts("diff");
    } else {
      if (ways[u][v])
        puts("diff");
      else
        puts("same");
    }
  }
}
int main() {
  int Test = 1;
  if (multipleTest) {
    cin >> Test;
  }
  for (int i = 0; i < Test; ++i) {
    solve();
  }
}
