#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  return (b < a) ? (a = b, 1) : 0;
}
using ll = long long;
using R = long double;
const R EPS = 1e-9L;
inline int sgn(const R &r) { return (r > EPS) - (r < -EPS); }
inline R sq(R x) { return sqrt(max(x, 0.0L)); }
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const pid_t pid = getpid();
const int limit = 1010;
using edge = struct { int to, id; };
vector<edge> graph[limit];
bool visited[limit];
int a[200010], b[200010];
void dfs(int v, int skip) {
  visited[v] = true;
  for (auto &e : graph[v]) {
    if (visited[e.to] or e.id == skip) continue;
    dfs(e.to, skip);
  }
}
int main(void) {
  int n, m;
  cin >> n >> m;
  for (int i = int(0); i < int(m); ++i) {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
    graph[a[i]].push_back({b[i], i});
  }
  for (int i = int(0); i < int(m); ++i) {
    for (int v = int(0); v < int(n); ++v) visited[v] = false;
    dfs(a[i], i);
    bool ab = visited[b[i]];
    for (int v = int(0); v < int(n); ++v) visited[v] = false;
    dfs(b[i], i);
    bool ba = visited[a[i]];
    if (ab != ba)
      puts("diff");
    else
      puts("same");
  }
  return 0;
}
