#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 1000;
const int MAXM = 200000;
int n, m;
int ghead[MAXN], gnxt[MAXM], gto[MAXM];
int rhead[MAXN], rnxt[MAXM], rto[MAXM];
int ans[MAXM];
int cur[MAXN], ncur;
int q[MAXN], qhead, qtail;
int mn[MAXN], mx[MAXN];
bool reach[MAXN];
void run() {
  scanf("%d%d", &n, &m);
  for (int i = (0); i < (n); ++i) ghead[i] = -1, rhead[i] = -1;
  for (int i = (0); i < (m); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    gnxt[i] = ghead[a], ghead[a] = i, gto[i] = b;
    rnxt[i] = rhead[b], rhead[b] = i, rto[i] = a;
  }
  for (int i = (0); i < (m); ++i) ans[i] = -1;
  for (int i = (0); i < (n); ++i) {
    ncur = 0;
    for (int x = ghead[i]; x != -1; x = gnxt[x]) cur[ncur++] = x;
    for (int j = (0); j < (n); ++j) mn[j] = INT_MAX;
    qhead = qtail = 0;
    for (int j = (0); j < (ncur); ++j) {
      int x = cur[j], rt = gto[x];
      if (mn[rt] != INT_MAX) continue;
      q[qhead++] = rt;
      mn[rt] = j;
      while (qtail < qhead) {
        int at = q[qtail++];
        for (int y = ghead[at]; y != -1; y = gnxt[y]) {
          int to = gto[y];
          if (mn[to] == INT_MAX) mn[to] = j, q[qhead++] = to;
        }
      }
    }
    for (int j = (0); j < (n); ++j) mx[j] = INT_MIN;
    mx[i] = -1;
    qhead = qtail = 0;
    for (int j = ncur - 1; j >= 0; --j) {
      int x = cur[j], rt = gto[x];
      if (mx[rt] != INT_MIN) continue;
      q[qhead++] = rt;
      mx[rt] = j;
      while (qtail < qhead) {
        int at = q[qtail++];
        for (int y = ghead[at]; y != -1; y = gnxt[y]) {
          int to = gto[y];
          if (mx[to] == INT_MIN) mx[to] = j, q[qhead++] = to;
        }
      }
    }
    for (int j = (0); j < (n); ++j) reach[j] = false;
    mn[i] = -1;
    qhead = qtail = 0;
    q[qhead++] = i;
    reach[i] = true;
    while (qtail < qhead) {
      int at = q[qtail++];
      for (int y = rhead[at]; y != -1; y = rnxt[y]) {
        int to = rto[y];
        if (!reach[to]) reach[to] = true, q[qhead++] = to;
      }
    }
    for (int j = (0); j < (ncur); ++j) {
      int x = cur[j], to = gto[x];
      bool ab = mn[to] != mx[to], ba = reach[to];
      ans[x] = ab == ba ? 0 : 1;
    }
  }
  for (int i = (0); i < (m); ++i) printf("%s\n", ans[i] ? "diff" : "same");
}
int main() {
  run();
  return 0;
}
