#include<bits/stdc++.h>
using namespace std;

int n, m;
int dfn[1010], low[1010], up[1010], dft, bel[1010], blt, st[1010], tp;
map<int,int>mp[1010]; int ans[202000];
vector<int>G[1010]; 

void tar(int x){
  dfn[x]=low[x]=++dft;
  st[++tp]=x;
  
  for (auto &y:G[x])
    if (dfn[y]){
      if (!bel[y]) low[x]=min(low[x],dfn[y]);
    }else{
      tar(y); low[x]=min(low[x],low[y]);
    }
  
  if (dfn[x]==low[x]){
    ++blt;
    for (;;){
      bel[st[tp]]=blt;
      if (st[tp--]==x) break;
    }
  }
}

void dfs(int x,int *vis,int tp){
  if (vis[x]) return; vis[x]=tp;
  for (auto &y:G[x]) dfs(y,vis,tp);
}

void doit(int x){
  memset(up,0,sizeof up); memset(low,0,sizeof low);
  up[x]=low[x]=x;
  sort(G[x].begin(),G[x].end());
  for (auto &y:G[x]) dfs(y,low,y);
  reverse(G[x].begin(),G[x].end());
  for (auto &y:G[x]) dfs(y,up,y);
  for (auto &y:G[x])
    ans[mp[x][y]]= (bel[x]!=bel[y]) ^ (up[y]==low[y]);
}

int main(){
  cin>>n>>m; int x, y;
  for (int i=1;i<=m;++i){
    scanf("%d%d",&x,&y);
    mp[x][y]=i; G[x].push_back(y);
  }
  for (int i=1;i<=n;++i) if (!dfn[i]) tar(i);
  
  for (int i=1;i<=n;++i) doit(i);
  for (int i=1;i<=m;++i) puts(ans[i]? "diff": "same");
}