def METHOD_NAME(i):
    """Returns the gate that acts on the ith qubit."""
    has_x = (x_msk >> i) & 1
    has_z = (z_msk >> i) & 1
    # The mapping is:
    #   - has_x and not has_z => X
    #   - not has_x and has_z => Z
    #   - has_x and has_z => Y
    #   - not has_x and not has_z => I
    gate_table = ['IX', 'ZY']
    return gate_table[has_z][has_x]