#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> v[(1010)];
int src, cv;
int vst[(1010)], a[(200010)], b[(200010)], suc[(1010)];
int f[(1010)][(1010)], g[(1010)][(1010)];
void dfs(int x) {
  for (auto it = v[x].begin(); it != v[x].end(); ++it) {
    int y = *it;
    if (cv != vst[y]) {
      if (suc[y]) f[src][y] = 1;
      vst[y] = cv;
      dfs(y);
    }
  }
}
void dfs2(int x) {
  vst[x] = cv;
  for (auto it = v[x].begin(); it != v[x].end(); ++it) {
    int y = *it;
    if (vst[y] != cv) {
      dfs2(y);
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", a + i, b + i);
    v[a[i]].push_back(b[i]);
  }
  for (int i = 1; i <= n; ++i) {
    src = i;
    for (int j = 1; j <= n; ++j) {
      suc[j] = 0;
    }
    for (auto it = v[i].begin(); it != v[i].end(); ++it) {
      suc[*it] = 1;
    }
    for (auto it = v[i].begin(); it != v[i].end(); ++it) {
      vst[i] = vst[*it] = ++cv;
      dfs(*it);
    }
    cv++;
    dfs2(i);
    for (int j = 1; j <= n; ++j) {
      g[i][j] = vst[j] == cv;
    }
  }
  for (int i = 1; i <= m; ++i) {
    printf("%s\n", !(f[a[i]][b[i]] ^ g[b[i]][a[i]]) ? "same" : "diff");
  }
}
