#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-6;
const long double pi = acos(-1.0);
void debug(vector<long long> &v) {
  int n = v.size();
  for (int i = 0; i < n; i++) {
    if (i > 0) cout << " ";
    cout << v[i];
  }
  cout << "\n";
}
int n;
vector<int> oriG[1000];
bool e[1000][1000];
int id[1000][1000];
bool ans[200000];
struct graph {
 private:
  int n;
  vector<vector<int>> G, rG;
  vector<bool> used;
  vector<int> vs;
  int mk;
  vector<vector<int>> fG;
  vector<vector<int>> ori;
  vector<int> trans;

 public:
  graph(int sz) {
    n = sz;
    G.resize(n);
    rG.resize(n);
    used.resize(n);
    fG.resize(n);
    trans.resize(n, -1);
    ori.resize(n);
  }
  void add_edge(int a, int b) {
    G[a].push_back(b);
    rG[b].push_back(a);
  }
  void dfs(int v) {
    used[v] = true;
    for (int i = 0; i < G[v].size(); i++) {
      if (!used[G[v][i]]) dfs(G[v][i]);
    }
    vs.push_back(v);
  }
  void rdfs(int v, int k) {
    used[v] = true;
    queue<int> q;
    q.push(v);
    vector<int> c;
    while (!q.empty()) {
      int id = q.front();
      q.pop();
      ori[k].push_back(id);
      for (int j = 0; j < rG[id].size(); j++) {
        int to = rG[id][j];
        if (used[to]) {
          if (trans[to] >= 0) c.push_back(trans[to]);
          continue;
        }
        used[to] = true;
        q.push(to);
      }
    }
    sort(c.begin(), c.end());
    int len = unique(c.begin(), c.end()) - c.begin();
    for (int i = 0; i < len; i++) {
      fG[c[i]].push_back(k);
    }
    for (int i = 0; i < ori[k].size(); i++) {
      trans[ori[k][i]] = k;
    }
  }
  void scc() {
    fill(used.begin(), used.end(), false);
    for (int i = 0; i < n; i++) {
      if (!used[i]) dfs(i);
    }
    fill(used.begin(), used.end(), false);
    int k = 0;
    for (int i = (int)vs.size() - 1; i >= 0; i--) {
      if (!used[vs[i]]) {
        rdfs(vs[i], k);
        k++;
      }
    }
    mk = k;
  }
  void query(int s) {
    vector<bool> sc(mk, false);
    vector<bool> exi(mk, false);
    queue<int> q;
    q.push(trans[s]);
    while (!q.empty()) {
      int id = q.front();
      q.pop();
      for (int j = 0; j < fG[id].size(); j++) {
        int to = fG[id][j];
        if (exi[to]) continue;
        exi[to] = true;
        q.push(to);
      }
    }
    for (int j = 0; j < mk; j++) {
      if (!exi[j]) continue;
      for (int k = 0; k < fG[j].size(); k++) {
        int to = fG[j][k];
        sc[to] = true;
      }
    }
    vector<int> num(mk, 0);
    for (int j = 0; j < oriG[s].size(); j++) {
      int to = oriG[s][j];
      to = trans[to];
      num[to]++;
      if (num[to] >= 2) sc[to] = true;
    }
    for (int i = 0; i < n; i++) {
      if (i == s) continue;
      if (id[s][i] < 0) continue;
      if (e[i][s] && !sc[trans[i]]) {
        ans[id[s][i]] = true;
      }
      if (!e[i][s] && sc[trans[i]]) {
        ans[id[s][i]] = true;
      }
    }
  }
};
vector<int> G[1000];
void solve() {
  int m;
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) id[i][j] = -1;
  vector<int> a(m), b(m);
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    id[a[i]][b[i]] = i;
    G[a[i]].push_back(b[i]);
    oriG[a[i]].push_back(b[i]);
  }
  for (int i = 0; i < n; i++) {
    queue<int> q;
    q.push(i);
    e[i][i] = true;
    while (!q.empty()) {
      int id = q.front();
      q.pop();
      for (int j = 0; j < G[id].size(); j++) {
        int to = G[id][j];
        if (e[i][to]) continue;
        q.push(to);
        e[i][to] = true;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    graph g(n);
    for (int j = 0; j < m; j++)
      if (b[j] != i) g.add_edge(a[j], b[j]);
    g.scc();
    g.query(i);
  }
  for (int i = 0; i < m; i++) {
    if (ans[i]) {
      cout << "diff" << endl;
    } else {
      cout << "same" << endl;
    }
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  char nyaa;
  cin >> nyaa;
  return 0;
}
