#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
bool can[1000][1000];
bool ans[200000];
vector<pair<int, int> > G[200000];
bool vis[1000];
void dfs(int s, int v) {
  can[s][v] = 1;
  for (pair<int, int> e : G[v]) {
    if (!can[s][e.first]) {
      dfs(s, e.first);
    }
  }
}
void dfs2(int v) {
  vis[v] = 1;
  for (pair<int, int> e : G[v]) {
    if (!vis[e.first]) {
      dfs2(e.first);
    }
  }
}
int main() {
  int N, M;
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].emplace_back(b, i);
  }
  for (int i = 0; i < N; i++) dfs(i, i);
  for (int i = 0; i < N; i++) {
    vector<pair<int, int> > edge = G[i];
    G[i].clear();
    memset(vis, 0, sizeof(vis));
    for (pair<int, int> e : edge) {
      if (can[e.first][i] == vis[e.first]) {
        ans[e.second] = 1;
      }
      G[i].push_back(e);
      dfs2(i);
    }
    reverse(edge.begin(), edge.end());
    G[i].clear();
    memset(vis, 0, sizeof(vis));
    for (pair<int, int> e : edge) {
      if (can[e.first][i] == vis[e.first]) {
        ans[e.second] = 1;
      }
      G[i].push_back(e);
      dfs2(i);
    }
  }
  for (int i = 0; i < M; i++) {
    if (ans[i])
      cout << "same" << endl;
    else
      cout << "diff" << endl;
  }
}
