#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
using namespace std;
vector<int> v[800002];
int n, m, a[800002][2], rt, id[1002][1002], ie[1002][1002];
bool re[1002][1002], ve[1002][1002], nx[1002][1002];
void dfs(int te) {
  for (int i = 0; i < v[te].size(); i++) {
    int j = v[te][i];
    if (!re[rt][j]) re[rt][j] = 1, dfs(j);
  }
}
void df55(int te, int ti) {
  for (int i = 0; i < v[te].size(); i++) {
    int j = v[te][i];
    if (te == rt) ti = i + 1;
    if (!id[rt][j])
      id[rt][j] = ti, df55(j, ti);
    else
      id[rt][j] = min(id[rt][j], ti);
  }
}
void df5(int te, int ti) {
  for (int i = ((int)v[te].size()) - 1; ~i; i--) {
    int j = v[te][i];
    if (te == rt) ti = i + 1;
    if (!ie[rt][j])
      ie[rt][j] = ti, df5(j, ti);
    else
      ie[rt][j] = max(ie[rt][j], ti);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    v[x].push_back(y);
    a[i][0] = x, a[i][1] = y;
    ve[x][y] = 1;
  }
  for (int i = 1; i <= n; i++) {
    rt = i, re[rt][rt] = 1, dfs(i);
    df55(i, 0);
    df5(i, 0);
    for (int j = 1; j <= n; j++) nx[i][j] = (id[i][j] != ie[i][j]);
  }
  for (int i = 1; i <= m; i++) {
    if (re[a[i][1]][a[i][0]] ^ nx[a[i][0]][a[i][1]])
      puts("diff");
    else
      puts("same");
  }
}
