a,b=map(int,input().split())
x,y=map(int,input().split())
if a==0 and b==0:
    print("nijedan");
if a==x and b==y:
    print("nijedan");
if a>x and b==y:
    print("prvi")
if a==x and b>y:
    print("drugi");
if a>x and b>y:
    print("?")