#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B>
bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
long long inf = sizeof(long long) == sizeof(long long) ? 2e18 : 1e9 + 10;
long long dx[] = {0, 1, 0, -1};
long long dy[] = {1, 0, -1, 0};
long long n, m;
vector<vector<long long> > in, G, rG, cost, out;
signed main() {
  cin >> n >> m;
  in = vector<vector<long long> >(m);
  G = rG = vector<vector<long long> >(n);
  cost = vector<vector<long long> >(n, vector<long long>(n, inf));
  for (long long i = 0; i < n; i++) cost[i][i] = 0;
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    cost[a][b] = 1;
    G[a].push_back(b);
    rG[b].push_back(a);
    in[i] = {a, b};
  }
  out = vector<vector<long long> >(m, vector<long long>(2));
  for (long long k = 0; k < n; k++)
    for (long long i = 0; i < n; i++)
      for (long long j = 0; j < n; j++)
        cmin(cost[i][j], cost[i][k] + cost[k][j]);
  for (long long i = 0; i < m; i++)
    if (out[i][0] ^ out[i][1])
      cout << "diff" << endl;
    else
      cout << "same" << endl;
}
