#include <bits/stdc++.h>
using namespace std;
class SCC {
 public:
  SCC(int n) : size(n), graph(n), num_scc(0), mapping(n){};
  void add_edge(int from, int to);
  void add_undirected_edge(int from, int to);
  void decompose();
  int get_size();
  vector<vector<int>> get_graph();
  vector<vector<int>> get_rgraph();
  vector<int> get_mapping();
  vector<int> get_weight();
  map<pair<int, int>, int> get_edge_weight();

 private:
  vector<vector<int>> graph;
  int size;
  int num_scc;
  vector<int> mapping;
};
void SCC::add_edge(int from, int to) { graph[from].push_back(to); }
void SCC::add_undirected_edge(int from, int to) {
  graph[from].push_back(to);
  graph[to].push_back(from);
}
void SCC::decompose() {
  int num_visit = 0, num_stack = 0, num_dfs = 0;
  int *order = (int *)malloc(sizeof(int) * size);
  int *low = (int *)malloc(sizeof(int) * size);
  bool *in = (bool *)malloc(sizeof(bool) * size);
  int *stack = (int *)malloc(sizeof(int) * size);
  int *dfs_v = (int *)malloc(sizeof(int) * size);
  int *dfs_index = (int *)malloc(sizeof(int) * size);
  for (int i = 0; i < size; i++) {
    order[i] = -1;
    in[i] = false;
  }
  for (int i = 0; i < size; i++) {
    if (order[i] != -1) continue;
    dfs_v[num_dfs] = i;
    dfs_index[num_dfs++] = -1;
    while (num_dfs > 0) {
      int v = dfs_v[--num_dfs];
      int index = dfs_index[num_dfs];
      if (index == -1) {
        order[v] = low[v] = num_visit++;
        stack[num_stack++] = v;
        in[v] = true;
      } else {
        low[v] = min(low[v], low[graph[v][index]]);
      }
      for (index++; index < graph[v].size(); index++) {
        int w = graph[v][index];
        if (order[w] == -1) {
          dfs_v[num_dfs] = v;
          dfs_index[num_dfs++] = index;
          dfs_v[num_dfs] = w;
          dfs_index[num_dfs++] = -1;
          break;
        } else if (in[w] == true) {
          low[v] = min(low[v], order[w]);
        }
      }
      if (index == graph[v].size() && low[v] == order[v]) {
        while (true) {
          int w = stack[--num_stack];
          in[w] = false;
          mapping[w] = num_scc;
          if (v == w) break;
        }
        num_scc++;
      }
    }
  }
  free(order);
  free(low);
  free(in);
  free(stack);
  free(dfs_v);
  free(dfs_index);
}
int SCC::get_size() { return num_scc; }
vector<vector<int>> SCC::get_graph() {
  vector<vector<int>> new_graph(num_scc);
  for (int i = 0; i < size; i++) {
    for (int j = 0; j < graph[i].size(); j++) {
      if (mapping[i] != mapping[graph[i][j]])
        new_graph[mapping[i]].push_back(mapping[graph[i][j]]);
    }
  }
  return new_graph;
}
vector<vector<int>> SCC::get_rgraph() {
  vector<vector<int>> new_graph(num_scc);
  for (int i = 0; i < size; i++) {
    for (int j = 0; j < graph[i].size(); j++) {
      if (mapping[i] != mapping[graph[i][j]])
        new_graph[mapping[graph[i][j]]].push_back(mapping[i]);
    }
  }
  return new_graph;
}
vector<int> SCC::get_mapping() { return mapping; }
vector<int> SCC::get_weight() {
  vector<int> weight(num_scc, 0);
  for (int i = 0; i < size; i++) weight[mapping[i]]++;
  return weight;
}
map<pair<int, int>, int> SCC::get_edge_weight() {
  map<pair<int, int>, int> weight;
  for (int i = 0; i < size; i++) {
    for (int j = 0; j < graph[i].size(); j++) {
      if (mapping[i] != mapping[graph[i][j]])
        weight[make_pair(mapping[i], mapping[graph[i][j]])]++;
    }
  }
  return weight;
}
int a[200000];
int b[200000];
int f[1000];
bitset<1000> b1[1000];
bitset<1000> b2[1000];
vector<pair<int, int>> v[1000];
vector<vector<int>> g;
vector<vector<int>> rg;
vector<int> mapping;
void dfs(int x) {
  int i;
  f[x] = 1;
  for (i = 0; i < g[x].size(); i++) {
    dfs(g[x][i]);
    b1[x][g[x][i]] = true;
    b1[x] |= b1[g[x][i]];
  }
}
void dfs2(int x) {
  int i;
  f[x] = 1;
  for (i = 0; i < rg[x].size(); i++) {
    dfs2(rg[x][i]);
    b2[x][rg[x][i]] = true;
    b2[x] |= b2[rg[x][i]];
  }
}
bool dfs3(int x, int y, int z) {
  int i;
  f[x] = 1;
  if (x == y) return true;
  for (i = 0; i < v[x].size(); i++) {
    int nx = v[x][i].first;
    if (f[nx] == 1) continue;
    if (mapping[nx] != mapping[x]) continue;
    if (v[x][i].second == z) continue;
    if (dfs3(nx, y, z)) return true;
  }
  return false;
}
int main() {
  int n, m, i, j;
  scanf("%d %d", &n, &m);
  SCC scc(n);
  for (i = 0; i < m; i++) {
    scanf("%d %d", &a[i], &b[i]);
    a[i]--;
    b[i]--;
    v[a[i]].push_back(make_pair(b[i], i));
    scc.add_edge(a[i], b[i]);
  }
  scc.decompose();
  g = scc.get_graph();
  rg = scc.get_rgraph();
  mapping = scc.get_mapping();
  map<pair<int, int>, int> weight = scc.get_edge_weight();
  for (i = 0; i < g.size(); i++) {
    if (f[i] == 0) dfs(i);
  }
  for (i = 0; i < g.size(); i++) f[i] = 0;
  for (i = 0; i < g.size(); i++) {
    if (f[i] == 0) dfs2(i);
  }
  for (i = 0; i < m; i++) {
    int x = mapping[a[i]], y = mapping[b[i]];
    if (x == y) {
      for (j = 0; j < n; j++) f[j] = 0;
      if (dfs3(a[i], b[i], i)) {
        puts("same");
      } else {
        puts("diff");
      }
    } else {
      if (weight[make_pair(x, y)] > 1 || (b1[x] & b2[y]).any()) {
        puts("diff");
      } else {
        puts("same");
      }
    }
    fflush(stdout);
  }
  return 0;
}
