#include <bits/stdc++.h>
using namespace std;
vector<int> ei[1000];
bool vis[1000];
vector<pair<int, int> > edges;
bool edge_enabled[200000];
bool dfs(int s, int e) {
  vis[s] = true;
  for (int i : ei[s]) {
    if (edge_enabled[i]) {
      int n = edges[i].second;
      if (n == e) {
        return true;
      }
      if (!vis[n] && dfs(n, e)) {
        return true;
      }
    }
  }
  return false;
}
int main(int argc, char *argv[]) {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    ei[a - 1].push_back(edges.size());
    edges.push_back(pair<int, int>(a - 1, b - 1));
  }
  fill(edge_enabled, edge_enabled + m, true);
  for (int i = 0; i < m; ++i) {
    edge_enabled[i] = false;
    fill(vis, vis + n, false);
    bool ab = dfs(edges[i].first, edges[i].second);
    fill(vis, vis + n, false);
    bool ba = dfs(edges[i].second, edges[i].first);
    cout << (ab == ba ? "same" : "diff") << endl;
    edge_enabled[i] = true;
  }
}
