x, y = map(int, input().split())

l = 0
for i in range(1, x+1):
    if x % i == 0:
        l += i

m = 0
for i in range(1, y+1):
    if y % i == 0:
        m += i

bo = False

if l == y:
    bo = True

boo = False

if m == x:
    boo = True

if bo == True and boo == True:
    print("friend")
else:
    print("not friend")