#include <bits/stdc++.h>
using namespace std;
const int NN = 1000 + 117;
const int MM = 200000 + 117;
int read() {
  int fl = 1, x;
  char c;
  for (c = getchar(); (c < '0' || c > '9') && c != '-'; c = getchar())
    ;
  if (c == '-') {
    fl = -1;
    c = getchar();
  }
  for (x = 0; c >= '0' && c <= '9'; c = getchar())
    x = (x << 3) + (x << 1) + c - '0';
  return x * fl;
}
void open() { freopen("a.in", "r", stdin); }
void close() {
  fclose(stdin);
  fclose(stdout);
}
int m, n;
vector<int> p[NN] = {};
vector<int> rp[NN] = {};
map<pair<int, int>, int> id;
bool ans[NN] = {};
int fir[NN] = {};
int las[NN] = {};
void col(int vis[], int x, int c) {
  if (vis[x]) return;
  vis[x] = c;
  for (int i = 0; i < p[x].size(); ++i) {
    col(vis, p[x][i], c);
  }
}
void getvis(int x) {
  for (int i = 1; i <= n; ++i) {
    fir[i] = las[i] = 0;
  }
  fir[x] = las[x] = -1;
  for (int j = 0; j < p[x].size(); ++j) {
    col(fir, p[x][j], j + 1);
  }
  for (int j = p[x].size() - 1; j >= 0; --j) {
    col(las, p[x][j], j + 1);
  }
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= m; ++i) {
    int x = read(), y = read();
    p[x].push_back(y);
    rp[y].push_back(x);
    id[make_pair(x, y)] = i;
  }
  for (int i = 1; i <= n; ++i) {
    getvis(i);
    for (int j = 0; j < rp[i].size(); ++j) {
      int cur = rp[i][j];
      bool fl = 0;
      if (fir[cur]) fl = 1;
      ans[id[make_pair(cur, i)]] ^= fl;
    }
    for (int j = 0; j < p[i].size(); ++j) {
      int cur = p[i][j];
      if (fir[cur] != j + 1 || las[cur] != j + 1) {
        ans[id[make_pair(i, cur)]] ^= 1;
      }
    }
  }
  for (int i = 1; i <= m; ++i) {
    if (ans[i])
      printf("diff\n");
    else
      printf("same\n");
  }
  close();
  return 0;
}
