#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 1;
int n, m;
int f[N][N][2], e[N * N][2], g[N], a[N * N][2];
void ins(int x, int y) {
  static int sum = 1;
  a[++sum][0] = y, a[sum][1] = g[x], g[x] = sum;
}
void dfs(int x, int s, int v) {
  for (int i = g[x]; i; i = a[i][1])
    if (a[i][0] != s) {
      if (x == s) v = a[i][0];
      if (f[s][a[i][0]][0] == v || f[s][a[i][0]][1] == v ||
          (f[s][a[i][0]][0] && f[s][a[i][0]][1]))
        continue;
      if (!f[s][a[i][0]][0])
        f[s][a[i][0]][0] = v;
      else
        f[s][a[i][0]][1] = v;
      dfs(a[i][0], s, v);
    }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> e[i][0] >> e[i][1];
    ins(e[i][0], e[i][1]);
  }
  for (int i = 1; i <= n; i++) dfs(i, i, 0);
  for (int i = 1; i <= m; i++) {
    bool sig = f[e[i][1]][e[i][0]][0];
    bool sig1 =
        ((f[e[i][0]][e[i][1]][0] && f[e[i][0]][e[i][1]][0] != e[i][1]) ||
         (f[e[i][0]][e[i][1]][1] && f[e[i][0]][e[i][1]][1] != e[i][1]));
    sig == sig1 ? cout << "same" << endl : cout << "diff" << endl;
  }
  return 0;
}
