#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long inf = mod * mod;
const long long d2 = (mod + 1) / 2;
const double EPS = 1e-10;
const double INF = 1e+10;
const double PI = acos(-1.0);
const int C_SIZE = 5121000;
namespace {
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a, int b) {
  if (a < b || b < 0) return 0;
  return fact[a] * finv[b] % mod * finv[a - b] % mod;
}
void init_C(int n) {
  fact[0] = finv[0] = inv[1] = 1;
  for (int i = 2; i < n; i++) {
    inv[i] = (mod - (mod / i) * inv[mod % i] % mod) % mod;
  }
  for (int i = 1; i < n; i++) {
    fact[i] = fact[i - 1] * i % mod;
    finv[i] = finv[i - 1] * inv[i] % mod;
  }
}
long long pw(long long a, long long b) {
  if (a < 0LL) return 0;
  if (b < 0LL) return 0;
  long long ret = 1;
  while (b) {
    if (b % 2) ret = ret * a % mod;
    a = a * a % mod;
    b /= 2;
  }
  return ret;
}
long long pw_mod(long long a, long long b, long long M) {
  if (a < 0LL) return 0;
  if (b < 0LL) return 0;
  long long ret = 1;
  while (b) {
    if (b % 2) ret = ret * a % M;
    a = a * a % M;
    b /= 2;
  }
  return ret;
}
int pw_mod_int(int a, int b, int M) {
  if (a < 0) return 0;
  if (b < 0) return 0;
  int ret = 1;
  while (b) {
    if (b % 2) ret = (long long)ret * a % M;
    a = (long long)a * a % M;
    b /= 2;
  }
  return ret;
}
int ABS(int a) { return max(a, -a); }
long long ABS(long long a) { return max(a, -a); }
double ABS(double a) { return max(a, -a); }
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}  // namespace
int x[210000];
int y[210000];
int ans[210000];
int v[2100];
vector<pair<int, int> > g[2100];
int L[2100];
int R[2100];
void dfs1(int a, int b) {
  L[a] = b;
  for (int i = 0; i < g[a].size(); i++) {
    if (~L[g[a][i].first]) continue;
    dfs1(g[a][i].first, b);
  }
}
void dfs2(int a, int b) {
  R[a] = b;
  for (int i = 0; i < g[a].size(); i++) {
    if (~R[g[a][i].first]) continue;
    dfs2(g[a][i].first, b);
  }
}
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  for (int i = 0; i < b; i++) {
    int p, q;
    scanf("%d%d", &p, &q);
    p--;
    q--;
    x[i] = p;
    y[i] = q;
    g[p].push_back(make_pair(q, i));
  }
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) v[j] = 0;
    v[i] = 1;
    queue<int> Q;
    Q.push(i);
    while (Q.size()) {
      int at = Q.front();
      Q.pop();
      for (int j = 0; j < g[at].size(); j++) {
        int to = g[at][j].first;
        if (v[to]) continue;
        v[to] = 1;
        Q.push(to);
      }
    }
    for (int j = 0; j < g[i].size(); j++) {
      if (v[g[i][j].first]) ans[g[i][j].second]++;
    }
  }
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < a; j++) {
      L[j] = R[j] = -1;
    }
    L[i] = R[i] = 0;
    for (int j = 0; j < g[i].size(); j++) {
      if (L[g[i][j].first] == -1) dfs1(g[i][j].first, j);
    }
    for (int j = g[i].size(); j > 0; j--) {
      if (R[g[i][j - 1].first] == -1) dfs2(g[i][j - 1].first, j - 1);
    }
    for (int j = 0; j < g[i].size(); j++) {
      if (L[g[i][j].first] != j || R[g[i][j].first] != j) ans[g[i][j].second]++;
    }
  }
  for (int i = 0; i < b; i++) {
    if (ans[i] == 1)
      printf("diff\n");
    else
      printf("same\n");
  }
}
