#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
int n, m;
int ex[MAXN], ey[MAXN];
vector<int> ver[MAXN];
bool ok[MAXN][MAXN];
void dfs(int u, bool tag[]) {
  tag[u] = 1;
  for (int v : ver[u])
    if (!tag[v]) dfs(v, tag);
}
int a[MAXN][MAXN], b[MAXN][MAXN];
void mak_tag(int u, int tag[], int id) {
  tag[u] = id;
  for (int v : ver[u])
    if (!tag[v]) mak_tag(v, tag, id);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, x, y; i <= m; i++) {
    scanf("%d%d", &x, &y);
    ver[x].push_back(y);
    ex[i] = x, ey[i] = y;
  }
  for (int i = 1; i <= n; i++) dfs(i, ok[i]);
  for (int i = 1; i <= n; i++) {
    a[i][i] = -1;
    for (int j = 0; j < (int)ver[i].size(); j++)
      if (!a[i][ver[i][j]]) mak_tag(ver[i][j], a[i], j + 1);
  }
  for (int i = 1; i <= n; i++) {
    b[i][i] = -1;
    for (int j = ver[i].size() - 1; ~j; j--)
      if (!b[i][ver[i][j]]) mak_tag(ver[i][j], b[i], j + 1);
  }
  for (int i = 1; i <= m; i++) {
    int x = ex[i], y = ey[i];
    puts((ok[y][x]) ^ (a[x][y] != b[x][y]) ? "diff" : "same");
  }
  return 0;
}
