from collections import deque

n, m, f, t, s = map(int, input().split())
d = {}
if t == s:
    print("death")
else:
    for i in range(m):
        x, y = map(int, input().split())
        if x not in d:
            d[x] = [y]
        else:
            d[x].append(y)
        if y not in d:
            d[y] = [x]
        else:
            d[y].append(x)
    used = [-1 for i in range(n + 1)]
    used[s] = 1
    queue = deque()
    queue.appendleft((0, s))
    ss = 0
    ll = 0
    while len(queue) > 0:
        topx, topy = queue.pop()
        used[topy] = topx
        for i in d[topy]:
            if i == t:
                if (topx + 1) % 2 == 0:
                    ss += 1
                else:
                    ll += 1
            if used[i] == -1 or used[i] > topx + 1:
                queue.appendleft((topx + 1, i))
            
    if ss == 0 or ll == 0:
        if ss != 0:
            print(used[f] + 1)
        else:
            print(used[f])
    else:
        print("death")

