#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> e[1005];
vector<pair<int, int> > E;
double cur;
bool used[1005];
bool dfs(int v, int x, int y) {
  if (v == y) return true;
  if (used[v]) return false;
  used[v] = 1;
  if (clock() - cur >= 4.9 * CLOCKS_PER_SEC / m) {
    return false;
  }
  for (int i = 0; i < e[v].size(); i++) {
    if (v == x && e[v][i] == y) continue;
    if (dfs(e[v][i], x, y)) return true;
  }
  return false;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    e[a].push_back(b);
    E.push_back(make_pair(a, b));
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    a = E[i].first, b = E[i].second;
    cur = clock();
    memset(used, 0, sizeof(used));
    bool flag = dfs(a, a, b);
    puts(flag ? "same" : "diff");
  }
}
