我好菜。。

while True :
    try :
        s=input()
        a= s.split('-')[0]
        b= s.split('-')[1]
        a1=a.split()
        b1=b.split()
        if 'joker' in a and 'JOKER' in a :
            print(a)
        elif 'joker' in b and 'JOKER' in b :
             print(b)
        elif len(a.split())==len(b.split()):
             if d_x[a1[0]] > d_x[b1[0]]:
                print(a)
             else :
                print(b)
        elif len(a.split())==4:
             print(a)
        elif len(b.split())==4:
             print(b)
        else:
             print('ERROR')
    except:
            break