#include <bits/stdc++.h>
using namespace std;
int nowp[1100], ask[4400], to[200100];
bool ans1[200100], ans2[200100];
vector<int> G[1100];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int a;
    scanf("%d%d", &a, &to[i]);
    G[a].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) nowp[j] = 0;
    int s = 1, t = 0;
    for (int p = 0; p < G[i].size(); p++)
      nowp[ask[++t] = to[G[i][p]]] = G[i][p];
    while (s <= t) {
      int x = ask[s++], y = nowp[x];
      for (int p = 0; p < G[x].size(); p++) {
        int q = to[G[x][p]];
        if (q != i && nowp[q] != -1) {
          if (!nowp[q])
            nowp[ask[++t] = q] = y;
          else if (nowp[q] != y)
            nowp[ask[++t] = q] = -1;
        } else
          ans1[G[x][p]] = 1;
      }
    }
    for (int p = 0; p < G[i].size(); p++)
      if (nowp[to[G[i][p]]] == -1) ans2[G[i][p]] = 1;
  }
  for (int i = 1; i <= m; i++) {
    if (ans1[i] == ans2[i])
      puts("same");
    else
      puts("diff");
  }
}
