#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int kMaxN = 1005, kMaxM = 200005;

int n, m, T;
vector<int> g[kMaxN];
int mat[kMaxM][2], p[kMaxN][kMaxN], q[kMaxN][kMaxN], vis[kMaxN];

void Mark(int st, int now, int id, int a[]) {
  if (now == st || vis[now] == T)
    return;
  vis[now] = T;
  a[now] = id;
  for (int nxt : g[now]) {
      Mark(st, nxt, id, a);
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1, a, b; i <= m; i++) {
    cin >> a >> b;
    mat[i][0] = a;
    mat[i][1] = b;
    g[a].push_back(b);
  }
  for (int i = 1; i <= n; i++) {
    ++T;
    int id = 0;
    for (int k : g[i])
      Mark(i, k, ++id, p[i]);
    reverse(g[i].begin(), g[i].end());
    ++T;
    id = g[i].size();
    for (int k : g[i])
      Mark(i, k, id--, q[i]);
  }
  for (int i = 1; i <= m; i++) {
    if ((p[mat[i][1]][mat[i][0]] > 0) == (p[mat[i][0]][mat[i][1]] != q[mat[i][0]][mat[i][1]])) {
      cout << "same\n";
    } else {
      cout << "diff\n";
    }
  }
  cout << flush;
  return 0;
}