#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:108777216")
using namespace std;
int const MAXN = 1024;
int n, m, sm[MAXN][MAXN], sm1[MAXN][MAXN], num, nnew[MAXN], lst[MAXN],
    e_ind[MAXN][MAXN], ans[256 * MAXN];
int bg[256 * MAXN], en[256 * MAXN];
int swp_flag[MAXN][MAXN], SWPF = 0;
void dfs1(int v) {
  nnew[v] = 1;
  for (int i = 1; i <= n; i++)
    if (!nnew[i] && sm[v][i]) dfs1(i);
  lst[num] = v;
  num--;
}
void dfs2(int v) {
  nnew[v] = num;
  for (int i = 1; i <= n; i++)
    if (!nnew[i] && sm[v][i]) dfs2(i);
}
int main() {
  int m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    sm[a][b] = 1;
    e_ind[a][b] = i;
    bg[i] = a;
    en[i] = b;
  }
  fill(nnew, nnew + n + 1, 0);
  num = n;
  for (int i = 1; i <= n; i++)
    if (!nnew[i]) dfs1(i);
  num = 0;
  fill(nnew, nnew + n + 1, 0);
  SWPF++;
  for (int i = 0; i < m; i++)
    if (swp_flag[bg[i]][en[i]] != SWPF) {
      swap(sm[bg[i]][en[i]], sm[en[i]][bg[i]]);
      swp_flag[bg[i]][en[i]] = swp_flag[en[i]][bg[i]] = SWPF;
    }
  for (int i = 1; i <= n; i++)
    if (!nnew[lst[i]]) {
      num++;
      dfs2(lst[i]);
    }
  SWPF++;
  for (int i = 0; i < m; i++)
    if (swp_flag[bg[i]][en[i]] != SWPF) {
      swap(sm[bg[i]][en[i]], sm[en[i]][bg[i]]);
      swp_flag[bg[i]][en[i]] = swp_flag[en[i]][bg[i]] = SWPF;
    }
  int init_num = num;
  for (int a = 1; a <= n; a++)
    for (int b = 1; b <= n; b++)
      if (sm[a][b]) {
        sm[a][b]--;
        sm[b][a]++;
        fill(nnew, nnew + n + 1, 0);
        num = n;
        for (int i = 1; i <= n; i++)
          if (!nnew[i]) dfs1(i);
        num = 0;
        fill(nnew, nnew + n + 1, 0);
        SWPF++;
        for (int i = 0; i < m; i++)
          if (swp_flag[bg[i]][en[i]] != SWPF) {
            swap(sm[bg[i]][en[i]], sm[en[i]][bg[i]]);
            swp_flag[bg[i]][en[i]] = swp_flag[en[i]][bg[i]] = SWPF;
          }
        for (int i = 1; i <= n; i++)
          if (!nnew[lst[i]]) {
            num++;
            if (num > init_num) break;
            dfs2(lst[i]);
          }
        SWPF++;
        for (int i = 0; i < m; i++)
          if (swp_flag[bg[i]][en[i]] != SWPF) {
            swap(sm[bg[i]][en[i]], sm[en[i]][bg[i]]);
            swp_flag[bg[i]][en[i]] = swp_flag[en[i]][bg[i]] = SWPF;
          }
        if (num == init_num)
          ans[e_ind[a][b]] = 1;
        else
          ans[e_ind[a][b]] = 0;
        sm[a][b]++;
        sm[b][a]--;
      }
  for (int i = 0; i < m; i++)
    if (ans[i])
      printf("same\n");
    else
      printf("diff\n");
  return 0;
}
