#include <bits/stdc++.h>
int vis[1000];
std::bitset<1000> bs[1000];
std::bitset<1000> bs2[1000];
std::bitset<1000> bs3[1000];
std::pair<int, int> p[200003];
int n, m;
int q[1000], qa, qb;
int vis1[1000], vis2[1000];
;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    p[i].first = a;
    p[i].second = b;
    bs[a][b] = 1;
  }
  for (int i = 0; i < n; ++i) {
    q[0] = i;
    qa = 0;
    qb = 1;
    bs2[i][i] = 1;
    while (qa < qb) {
      int cur = q[qa++];
      std::bitset<1000> nex = ~bs2[i] & bs[cur];
      bs2[i] |= nex;
      for (int j = 0; j < n; ++j)
        if (nex[j]) q[qb++] = j;
    }
  }
  for (int i = 0; i < n; ++i) {
    memset(vis1, -1, sizeof(vis1));
    memset(vis2, -1, sizeof(vis2));
    for (int j = 0; j < n; ++j)
      if (bs[i][j] && vis1[j] == -1) {
        q[0] = j;
        qa = 0;
        qb = 1;
        vis1[j] = j;
        while (qa < qb) {
          int cur = q[qa++];
          for (int k = 0; k < n; ++k)
            if (k != i && bs[cur][k] && vis1[k] == -1) {
              vis1[k] = j;
              q[qb++] = k;
            }
        }
      }
    for (int j = n - 1; j >= 0; --j)
      if (bs[i][j] && vis2[j] == -1) {
        q[0] = j;
        qa = 0;
        qb = 1;
        vis2[j] = j;
        while (qa < qb) {
          int cur = q[qa++];
          for (int k = 0; k < n; ++k)
            if (k != i && bs[cur][k] && vis2[k] == -1) {
              vis2[k] = j;
              q[qb++] = k;
            }
        }
      }
    for (int j = 0; j < n; ++j)
      if (vis1[j] != vis2[j]) bs3[i][j] = 1;
  }
  for (int i = 0; i < m; ++i) {
    int a = p[i].first, b = p[i].second;
    if (bs2[b][a] == bs3[a][b]) {
      printf("same\n");
    } else {
      printf("diff\n");
    }
  }
}
