#include <bits/stdc++.h>
using namespace std;
const int N = 3.3e3, M = 2.2e5;
vector<int> v[N];
int n, m, s[M], t[M], dp[N][N], a[N][N], vis[N];
void dfs(int x, int S, int fi) {
  a[S][x] = 1;
  for (int i = 0; i < v[x].size(); i++) {
    int j = v[x][i];
    if (j != fi) dp[S][j] = 1;
    if (vis[j]) continue;
    vis[j] = 1;
    dfs(j, S, fi);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, x, y; i <= m; i++) {
    scanf("%d%d", &x, &y), v[x].push_back(y);
    s[i] = x, t[i] = y;
  }
  for (int i = 1; i <= n; i++) {
    memset(vis, 0, sizeof(vis));
    vis[i] = 1;
    for (int j = 0; j < v[i].size(); j++) vis[v[i][j]] = 1;
    for (int j = 0; j < v[i].size(); j++) dfs(v[i][j], i, v[i][j]);
  }
  for (int i = 1; i <= m; i++)
    if ((dp[s[i]][t[i]] && !a[t[i]][s[i]]) ||
        (a[t[i]][s[i]] && !dp[s[i]][t[i]]))
      puts("diff");
    else
      puts("same");
}
