#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e3 + 10;
const int M = (int)2e5 + 10;
const int K = (int)350;
const long long LINF = (long long)1e18;
const int INF = (int)1e9 + 7;
const int ALPHA = 26;
const int mod = INF + 2;
const double PI = 3.14159265359;
const long double EPS = (long double)1e-12;
int n, m;
vector<pair<int, int> > v[N];
int from[M], to[M];
int u[2][N];
int bad_id;
void dfs(int r, int x) {
  u[r][x] = 1;
  for (auto it : v[x]) {
    if (it.second == bad_id) {
      continue;
    }
    if (!u[r][it.first]) {
      dfs(r, it.first);
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> from[i] >> to[i];
    v[from[i]].push_back(make_pair(to[i], i));
  }
  for (int i = 1; i <= m; i++) {
    memset(u, 0, sizeof(u));
    bad_id = i;
    dfs(0, from[i]);
    dfs(1, to[i]);
    if (u[0][to[i]] + u[1][from[i]] == 1) {
      cout << "diff\n";
    } else {
      cout << "same\n";
    }
  }
  return 0;
}
