def isogen3(e0, sk3, e3, xp2, xq2, xr2, xp3, xq3, xr3):
    """
    Generate public key in 3^e3-torsion
    Alg. 22 from [SIKE]
    :param e0: starting curve
    :param sk3: Bob's secret key
    :param e3: Degree of 3
    :param xp2: X-coordinate of Alice's basis point P
    :param xq2: X-coordinate of Alice's basis point Q
    :param xr2: X-coordinate of Alice's basis point Q-P
    :param xp3: X-coordinate of Bob's basis point P
    :param xq3: X-coordinate of Bob's basis point Q
    :param xr3: X-coordinate of Bob's basis point Q-P
    :return: public key encoded by the x-coordinates of the three points
    """
    s = e0.ladder3pt(sk3, xp3, xq3, xr3)
#    print('Bobs secret generator:', s)
    [eA, x1, x2, x3] = e0.iso3e(e3, s, xp2, xq2, xr2)
    return [x1.getx(), x2.getx(), x3.getx()]