#include <bits/stdc++.h>
using namespace std;
struct edg {
  int x, i;
};
vector<edg> arr[1010];
int dis[1010];
stack<int> stk;
int tim;
int low[1010];
int num[1010];
vector<int> scc[1010];
int siz;
void f(int x) {
  dis[x] = ++tim;
  low[x] = dis[x];
  stk.push(x);
  for (edg &e : arr[x]) {
    if (!dis[e.x]) {
      f(e.x);
      low[x] = min(low[x], low[e.x]);
    } else if (!num[e.x])
      low[x] = min(low[x], dis[e.x]);
  }
  if (low[x] == dis[x]) {
    siz++;
    while (1) {
      int t = stk.top();
      stk.pop();
      num[t] = siz;
      scc[siz].push_back(t);
      if (t == x) break;
    }
  }
}
bool chk1[1010];
bool chk2[1010];
void dfs(int x, bool *chk) {
  chk[x] = 1;
  for (edg &e : arr[x])
    if (!chk[e.x]) dfs(e.x, chk);
}
bool res[200010];
int main() {
  int n, m, i;
  scanf("%d%d", &n, &m);
  for (i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    arr[x].push_back({y, i});
  }
  for (i = 1; i <= n; i++)
    if (!dis[i]) f(i);
  for (i = 1; i <= n; i++)
    for (edg &e : arr[i])
      if (num[i] == num[e.x]) res[e.i] = 1;
  for (i = 1; i <= n; i++) {
    memset(chk1, 0, sizeof chk1);
    memset(chk2, 0, sizeof chk2);
    chk1[i] = chk2[i] = 1;
    for (edg &e : arr[i]) {
      if (num[i] == num[e.x]) {
        if (chk1[e.x]) res[e.i] = 0;
        dfs(e.x, chk1);
      } else {
        if (chk2[e.x]) res[e.i] = 1;
        dfs(e.x, chk2);
      }
    }
    reverse(arr[i].begin(), arr[i].end());
    memset(chk1, 0, sizeof chk1);
    memset(chk2, 0, sizeof chk2);
    chk1[i] = chk2[i] = 1;
    for (edg &e : arr[i]) {
      if (num[i] == num[e.x]) {
        if (chk1[e.x]) res[e.i] = 0;
        dfs(e.x, chk1);
      } else {
        if (chk2[e.x]) res[e.i] = 1;
        dfs(e.x, chk2);
      }
    }
  }
  for (i = 0; i < m; i++) {
    if (res[i])
      printf("diff\n");
    else
      printf("same\n");
  }
  return 0;
}
