#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< typename G >
struct StronglyConnectedComponents {
  const G &g;
  UnWeightedGraph gg, rg;
  vector< int > comp, order, used;

  StronglyConnectedComponents(G &g) : g(g), gg(g.size()), rg(g.size()), comp(g.size(), -1), used(g.size()) {
    for(int i = 0; i < g.size(); i++) {
      for(auto e : g[i]) {
        gg[i].emplace_back((int) e);
        rg[(int) e].emplace_back(i);
      }
    }
    for (int i = 0; i < g.size(); i++)
    {
        sort(gg[i].begin(),gg[i].end());
        sort(rg[i].begin(),rg[i].end());
    }
  }

  void revEdge(int a, int b){
      auto itrgg_erase = lower_bound(gg[a].begin(),gg[a].end(),b);
      gg[a].erase(itrgg_erase);
      auto itrrg_erase = lower_bound(rg[b].begin(),rg[b].end(),a);
      rg[b].erase(itrrg_erase);
      auto itrgg_insert = lower_bound(gg[b].begin(),gg[b].end(),a);
      gg[b].insert(itrgg_insert,a);
      auto itrrg_insert = lower_bound(rg[a].begin(),rg[a].end(),b);
      rg[a].insert(itrrg_insert,b);
  }

  int operator[](int k) {
    return comp[k];
  }

  void dfs(int idx) {
    if(used[idx]) return;
    used[idx] = true;
    for(int to : gg[idx]) dfs(to);
    order.push_back(idx);
  }

  void rdfs(int idx, int cnt) {
    if(comp[idx] != -1) return;
    comp[idx] = cnt;
    for(int to : rg[idx]) rdfs(to, cnt);
  }

  void build(UnWeightedGraph &t) {
    order.clear();
    fill(comp.begin(),comp.end(),-1);
    fill(used.begin(),used.end(), 0);
    
    for(int i = 0; i < gg.size(); i++) dfs(i);
    reverse(begin(order), end(order));
    int ptr = 0;
    for(int i : order) if(comp[i] == -1) rdfs(i, ptr), ptr++;

    t.resize(ptr);
    for(int i = 0; i < g.size(); i++) {
      for(auto &to : g[i]) {
        int x = comp[i], y = comp[to];
        if(x == y) continue;
        t[x].push_back(y);
      }
    }
  }
};


int N;
ll M;
vector<ll> A,B;
UnWeightedGraph g, revG;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N >> M;
    g.resize(N);
    revG.resize(N);
    for (int i = 0; i < M; i++)
    {
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        A.push_back(a);
        B.push_back(b);
        g[a].emplace_back(b);
    }
    
}

int TLEsolve(){
    StronglyConnectedComponents< UnWeightedGraph > scc(g);
    UnWeightedGraph buff;
    scc.build(buff);
    int cntG=0;
    vector<bool> seen(N);
    for (int i = 0; i < N; i++)
    {
        if(!seen[scc[i]]) cntG++;
        seen[scc[i]] = true;
    }
    DBG(cntG)
    for (int i = 0; i < M; i++)
    {
        // StronglyConnectedComponents< UnWeightedGraph > sccrev(g);
        // strcpy(sccrev,scc);
        scc.revEdge(A[i],B[i]);
        scc.build(buff);
        int cntrevG=0;
        vector<bool> seen_revG(N);
        for (int i = 0; i < N; i++)
        {
            if(!seen_revG[scc[i]]) cntrevG++;
            seen_revG[scc[i]] = true;
        }
        if(cntG==cntrevG) cout << "same" << "\n";
        else cout << "diff" << "\n";
        scc.revEdge(B[i],A[i]);
    }
    
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}
