#include<bits/stdc++.h>

using namespace std;

#define ll  long long
#define ld  double

#define sz(x)   (int)x.size()
#define all(x)  x.begin(),x.end()

#define pb  emplace_back
#define X   first
#define Y   second

const int   N   = 1005;
const int   M   = 2e5 + 5;

typedef pair<int,int>   ii;

bool ans[M];
bool vis[N];

vector<ii>  fr[N];
vector<ii>  to[N];

void dfs(int u,int forbid)  {
    if(!vis[u]) {
        vis[u] = 1;

        for(ii  e : fr[u])  if (e.X != forbid)
            dfs(e.X,forbid);
    }
}

int main()  {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n;  cin >> n;
    int m;  cin >> m;

    for(int i = 0 ; i < m ; ++i)    {
        int x;  cin >> x;
        int y;  cin >> y;
        
        fr[x].pb(y,i);
        to[y].pb(x,i);
    }
    for(int u = 1 ; u <= n ; ++u)   {
        fill(vis + 1,vis + 1 + n,0);    for(ii  e : fr[u])  ans[e.Y] |= vis[e.X],   dfs(e.X,u);     reverse(all(fr[u]));
        fill(vis + 1,vis + 1 + n,0);    for(ii  e : fr[u])  ans[e.Y] |= vis[e.X],   dfs(e.X,u);
    }
    for(int u = 1 ; u <= n ; ++u)   {
        fill(vis + 1,vis + 1 + n,0);

        dfs(u,0);

        for(ii  e : to[u])
            ans[e.Y] ^= vis[e.X];
    }
    for(int i = 0 ; i < m ; ++i)    {
        if (ans[i]) cout << "diff\n";
        else        cout << "same\n";
    }
}