#include <bits/stdc++.h>
using namespace std;
const int N = 4e5;
int n, m, k;
int touch[N], ord[N];
int mar[N], a[N], b[N];
vector<pair<int, int> > ed[N];
void dfs(int u, int tp, int f) {
  mar[u] = 1;
  for (int i = 0; i < ed[u].size(); i++) {
    int to = ed[u][i].first;
    int lnk = ed[u][i].second;
    if (mar[to]) continue;
    if (touch[lnk] == 0) touch[lnk] = f;
    if (tp != (lnk > m)) continue;
    dfs(to, tp, f);
  }
  if (tp == 0) {
    k++;
    ord[k] = u;
  }
}
int calc(int f) {
  for (int i = 1; i <= n; i++) {
    mar[i] = 0;
    ed[i].clear();
  }
  k = 0;
  for (int i = 1; i <= m; i++) {
    int u = a[i], v = b[i];
    ed[u].push_back(make_pair(v, i));
    ed[v].push_back(make_pair(u, i + m));
  }
  for (int i = 1; i <= n; i++)
    if (mar[i] == 0) dfs(i, 0, f);
  for (int i = 1; i <= n; i++) mar[i] = 0;
  int cnt = 0;
  for (int i = n; i >= 1; i--) {
    int v = ord[i];
    if (mar[v] != 0) continue;
    cnt++;
    dfs(v, 1, f);
  }
  return cnt;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) cin >> a[i] >> b[i];
  int sample = calc(1);
  int ans = 0;
  for (int i = 1; i <= m; i++)
    if (touch[i]) {
      swap(a[i], b[i]);
      int cur = calc(0);
      if (cur != sample)
        cout << "diff\n";
      else
        cout << "same\n";
      swap(a[i], b[i]);
    } else
      cout << "same\n";
  return 0;
}
