#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t { as swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;

using XY = pair<int, int>;

vector<vector<int>> nodes;
vector<bool> visited;

void mark(int t, int c, int id, vector<int> &map) {
    if (c == t || visited[c]) return;
    visited[c] = true;
    map[c] = id;
    forin(i, 0, nodes[c].size()) {
        mark(t, nodes[c][i], id, map);
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<XY> e(m);
    nodes.resize(n + 1);
    forin(i, 0, m) {
        cin >> e[i].first >> e[i].second;
        nodes[e[i].first].push_back(e[i].second);
    }
    vector<vector<int>> fMap(n + 1, vector<int>(n + 1, 0)), dMap(n + 1, vector<int>(n + 1, 0));
    forin(i, 1, n + 1) {
        visited.assign(n + 1, false);
        int id = 1;
        forin(j, 0, nodes[i].size()) {
            mark(i, nodes[i][j], id++, fMap[i]);
        }
        visited.assign(n + 1, false);
        id = (int)nodes[i].size();
        for (auto j = nodes[i].size(); j > 0; --j) {
            mark(i, nodes[i][j - 1], id--, dMap[i]);
        }
    }
    forin(i, 0, m) {
        auto edge = e[i];
        if ((fMap[edge.first][edge.second] != dMap[edge.first][edge.second]) == (fMap[edge.second][edge.first] > 0)) {
            cout << "same" << endl;
        } else {
            cout << "diff" << endl;
        }
    }
}
