def rotation(list1, list2) :
    if len(list1) != len(list2) :
        return False

    key = list1[0]
    key_index = 0

    for i in range(len(list2)) :
        if list2[i] == key :
            key_index = i 
            break

    if key_index == 0 :
        return False
    
    for i in range(len(list1)) :
        j = (key_index + i) % len(list1)

        if list1[i] != list2[j] :
            return False
    return True

print(rotation([1,2,3,4,5,6,7],[4,5,6,7,1,2,3]))