#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long xx = 0, flagg = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') {
    flagg = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    xx = xx * 10 + ch - '0';
    ch = getchar();
  }
  return xx * flagg;
}
void pus(long long xx, long long flagg) {
  if (xx < 0) {
    putchar('-');
    xx = -xx;
  }
  if (xx >= 10) pus(xx / 10, 0);
  putchar(xx % 10 + '0');
  if (flagg == 1) putchar(' ');
  if (flagg == 2) putchar('\n');
  return;
}
int n, m, i, x[200005], y[200005], book[1005];
int top, nex[200005], to[200005], fir[1005];
map<int, int> mp[1005], mp2[1005];
inline void lj(int u, int v) {
  top++;
  nex[top] = fir[u];
  fir[u] = top;
  to[top] = v;
}
inline void ss(int v, int w) {
  book[v] = i;
  mp[i][v] = w;
  for (int top1 = fir[v]; top1; top1 = nex[top1])
    if (book[to[top1]] != i) ss(to[top1], w == 0 ? top1 : w);
}
inline void ss2(int v, int w) {
  book[v] = i;
  mp2[i][v] = w;
  for (int top1 = fir[v]; top1; top1 = nex[top1])
    if (book[to[top1]] != i) ss2(to[top1], w == 0 ? top1 : w);
}
int main() {
  n = read();
  m = read();
  for (i = 1; i <= m; i++) {
    x[i] = read();
    y[i] = read();
    lj(x[i], y[i]);
  }
  for (i = 1; i <= n; i++) ss(i, 0);
  for (i = 1; i <= top; i++) {
    nex[i] = 0;
    to[i] = 0;
  }
  for (i = 1; i <= n; i++) {
    book[i] = 0;
    fir[i] = 0;
  }
  top = 0;
  for (i = m; i >= 1; i--) lj(x[i], y[i]);
  for (i = 1; i <= n; i++) ss2(i, 0);
  for (i = 1; i <= m; i++) {
    if ((mp[y[i]][x[i]] != 0) + (mp[x[i]][y[i]] + mp2[x[i]][y[i]] == m + 1) ==
        1)
      printf("same\n");
    else
      printf("diff\n");
  }
  return 0;
}
