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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

ll n,m;
vector<ll> g[1010];
vector<P> es;
ll cnt[1010][1010];
bool vis[1010];

void dfs(ll v,ll st){
  vis[v]=true;
  cnt[st][v]++;
  for(ll nv : g[v]){
    if(vis[nv]||nv==st||cnt[st][nv]>=2)continue;
    dfs(nv,st);
  }
}

int main(){
  cin>>n>>m;
  rep(i,m){
    ll a,b;
    cin>>a>>b;
    a--;b--;
    g[a].push_back(b);
    es.push_back(P(a,b));
  }

  rep(i,n){
    for(ll v : g[i]){
      memset(vis,0,sizeof(vis));
      dfs(v,i);
    }
  }

  rep(i,m){
    ll a=cnt[es[i].fi][es[i].se];
    ll b=cnt[es[i].se][es[i].fi];
    if((a>=2&&b>=1)||(a<2&&b<1))cout<<"same"<<endl;
    else cout<<"diff"<<endl;
  }
  return 0;
}
